# Graphics Scripting Extension for browsers

This topic is 4479 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

What I would like to do is create an ActiveX control in C++ which translates some scripts in text form into graphics and animation. This would be different from Flash because the script would be human readable and so anyone could write the scripts for their website without having to buy a Flash writer. The control would be free to download. Maybe there is already a control like this out there? Or perhaps there is a simple way of making one that I have missed? So for example you would include a text file in your website animation.graphics for example which would say something like:
for(x=1;x<10;x++){
SetColor(255,0,0);
Ellipse(50,200,500,300);
SwapFrames;
SetColor(255,128,0);
Rectangle(0,0,600,600);
SwapFrames;
}

and then embed the ActiveX control in your webpage which interprets this file and displays the graphics. If there is not one out there could anyone suggest some minimum requirements?

##### Share on other sites
That sounds like Canvas, which is supported on multiple platforms in most popular browsers (Firefox, Opera, Safari) and can be kind of hacked into IE in a limited way, and it's not evil ActiveX. You would write JavaScript code roughly like
var ctx = document.getElementById('canvas').getContext('2d');for (var x = 1; x < 10; ++x) {  ctx.fillstyle = '#ff0000';  ctx.beginPath();  ctx.arc(50, 200, 500, 0, 2*Math.PI, false);  ctx.fill();  ctx.fillstyle = 'rgb(255,128,0)';  ctx.fillRect(0, 0, 600, 600);}
(untested, and doesn't actually draw an ellipse - you'd probably need to add a function which does some simple scaling transformation first). Animation is a tiny bit trickier, since you have to run the frame-rendering in a setTimeout/setInterval and draw one frame at a time - i.e. you need a drawNextFrame() function which is called repeatedly, and you can't have a drawAllFrames() function which calls SwapFrames() in the middle. But it's powerful enough to do reasonably complex things (like this (doesn't work at all in IE, for half a dozen reasons)), and it's already supported and mostly standardised, so it's better than making a new proprietary graphics/scripting system.

(What would be nice is an IE-compatible plugin (or, if really necessary, ActiveX control) that implements the standard canvas interface fully (unlike the current canvas-in-IE hacks) - then cross-browser code could actually work in IE too, even though it's not supported by the browser itself, in the same way that Adobe's SVG plugin makes up for IE's lack of SVG support...)

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633702
• Total Posts
3013450
×