SVG powered images

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

SVG powered images

Bob Sneidar via use-livecode
This mousedown script shows a rough preview
of the SVG animation if you put it into the image:

 on mousedown
put the id of me into tID
    repeat while the mouse is down
    send "processSVG tID" to widget "SVGBrowser1"
    end repeat
 end mousedown

Al
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: SVG powered images

Bob Sneidar via use-livecode
> Jonathan L. wrote:
> However, delaying the command to send for the image does not work
> for the first resizing of the image in this scenario.

It works. I have it running here with the browser widget. I finally
got it using an "onload" for the image and for the window.

...
image1.onload = function() {
   ctx.drawImage(image1,0,0,twidth,theight);
}
...
window.onload=processsvg(twidth,theight,tID);

After that sending toDataURL() to the canvas delayed by 1 tick has here
no misfunction.

I wrote it also for a revBrowserInstance what can be used in LC 6/7/8/9
but on Mac only, because linux has no revBroser working and windows only
one that doesn't support Canvas2d. This is essentially the same technique
(but doesn't use a javascriptHandler).

I put this LC 6/7/8/9 version on livecodeshare/"sample stacks" so that
your browser widget version is still unique ...

I have also a fast method, runs with 30 fps, for taking PNG-frames from a
video, so that converting an SVG animation to PNGs is no problem (though
I can't see any sense in doing that).

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: SVG powered images

Bob Sneidar via use-livecode
In reply to this post by Bob Sneidar via use-livecode
How does it look?

Sent from my iPhone

> On May 11, 2017, at 10:15 PM, Alejandro Tejada via use-livecode <[hidden email]> wrote:
>
> This mousedown script shows a rough preview
> of the SVG animation if you put it into the image:
>
> on mousedown
> put the id of me into tID
>   repeat while the mouse is down
>   send "processSVG tID" to widget "SVGBrowser1"
>   end repeat
> end mousedown
>
> Al
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: SVG powered images

Bob Sneidar via use-livecode
In reply to this post by Bob Sneidar via use-livecode
Hey guys - I figured out a solution for that bug I had previously written a hack for. I use the image.onload handler in the JavaScript for this. It works consistently now. I just had to get my order of events correct in the JavaScript.

So please check out the new version.

J

Sent from my iPhone

> On May 11, 2017, at 10:15 PM, Alejandro Tejada via use-livecode <[hidden email]> wrote:
>
> This mousedown script shows a rough preview
> of the SVG animation if you put it into the image:
>
> on mousedown
> put the id of me into tID
>   repeat while the mouse is down
>   send "processSVG tID" to widget "SVGBrowser1"
>   end repeat
> end mousedown
>
> Al
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: SVG powered images

Bob Sneidar via use-livecode
In reply to this post by Bob Sneidar via use-livecode
Hi Hermann - I just got this message - I arrived at the same onload conclusion.

I get it now, but the way the JavaScript had to be ordered seemed counterintuitive at first.

Thanks for your help on this :)

Sent from my iPhone

On May 12, 2017, at 5:24 AM, hh via use-livecode <[hidden email]> wrote:

>> Jonathan L. wrote:
>> However, delaying the command to send for the image does not work
>> for the first resizing of the image in this scenario.
>
> It works. I have it running here with the browser widget. I finally
> got it using an "onload" for the image and for the window.
>
> ...
> image1.onload = function() {
>   ctx.drawImage(image1,0,0,twidth,theight);
> }
> ...
> window.onload=processsvg(twidth,theight,tID);
>
> After that sending toDataURL() to the canvas delayed by 1 tick has here
> no misfunction.
>
> I wrote it also for a revBrowserInstance what can be used in LC 6/7/8/9
> but on Mac only, because linux has no revBroser working and windows only
> one that doesn't support Canvas2d. This is essentially the same technique
> (but doesn't use a javascriptHandler).
>
> I put this LC 6/7/8/9 version on livecodeshare/"sample stacks" so that
> your browser widget version is still unique ...
>
> I have also a fast method, runs with 30 fps, for taking PNG-frames from a
> video, so that converting an SVG animation to PNGs is no problem (though
> I can't see any sense in doing that).
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode