|
|
(35 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
− | Naar de Nederlandse versie: [[Qmaze2D_How_To/nl]]
| + | [[Qmaze2D_How_To/nl|Naar de Nederlandse versie]]<br /> |
| = '''Qmaze 2D product configurator user manual''' -- Engels / English = | | = '''Qmaze 2D product configurator user manual''' -- Engels / English = |
| + | <br /> |
| + | Below you can find information for every individual function, you will find; |
| + | *A list containing every function. |
| + | *What the functions do exactly. |
| + | *How to use the functions (Rules & Outputscript). |
| + | *Examples |
| + | ====[[Qmaze2D_How_To/en/functions|Individual function explanation]]==== |
| <br /> | | <br /> |
| ==1. Getting started== | | ==1. Getting started== |
Line 10: |
Line 17: |
| ===Templates=== | | ===Templates=== |
| ====Template: The canvas uses the surrounding container for it's size.==== | | ====Template: The canvas uses the surrounding container for it's size.==== |
− | [[File:Qmaze2d_howto_en_template1.png]]
| + | |
| + | <nowiki> |
| + | <!-- GET FabricJS Script Minified--> |
| + | <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/4.1.0/fabric.min.js"></script> |
| + | <!-- GET 2D Lib Script --> |
| + | <script src="Scripts/Qmaze2dlib.js"></script> |
| + | |
| + | <canvas id="your canvas name"></canvas> |
| + | |
| + | <script> |
| + | $(document).ready(function() |
| + | { |
| + | // This function must be run per individual canvas |
| + | setcanvas('your canvas name'); |
| + | |
| + | // You can place your functions here |
| + | }); |
| + | </script> |
| + | </nowiki> |
| + | |
| + | |
| <br /> | | <br /> |
| + | |
| ====Template: You choose the sizing yourself.==== | | ====Template: You choose the sizing yourself.==== |
− | [[File:Qmaze2d_howto_en_template2.png]]
| + | |
| + | <nowiki> |
| + | <!-- GET FabricJS Script Minified--> |
| + | <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/4.1.0/fabric.min.js"></script> |
| + | <!-- GET 2D Lib Script --> |
| + | <script src="Scripts/Qmaze2dlib.js"></script> |
| + | |
| + | <canvas id="your canvas name" style="height: height px; width: width px"></canvas> |
| + | |
| + | <script> |
| + | $(document).ready(function() |
| + | { |
| + | // This function must be run per individual canvas |
| + | setcanvas('your canvas name'); |
| + | |
| + | // You can place your functions here |
| + | }); |
| + | </script> |
| + | </nowiki> |
| + | |
| + | |
| <br /> | | <br /> |
| + | |
| ====Template: You add a container yourself where you define the sizing. (Without bootstrap)==== | | ====Template: You add a container yourself where you define the sizing. (Without bootstrap)==== |
− | [[File:Qmaze2d_howto_en_template3.png]]
| + | |
| + | <nowiki> |
| + | <!-- GET FabricJS Script Minified--> |
| + | <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/4.1.0/fabric.min.js"></script> |
| + | |
| + | <!-- GET 2D Lib Script --> |
| + | <script src="Scripts/Qmaze2dlib.js"></script> |
| + | |
| + | <div style="height: height px; width: width px "> |
| + | <canvas id="your canvas name"></canvas> |
| + | </div> |
| + | |
| + | <script> |
| + | $(document).ready(function() |
| + | { |
| + | // This function must be run per individual canvas |
| + | setcanvas('your canvas name'); |
| + | |
| + | // You can place your functions here |
| + | }); |
| + | |
| + | </script> |
| + | </nowiki> |
| + | |
| <br /> | | <br /> |
| + | |
| ====Template: You add a container yourself where you define the sizing. (With bootstrap)==== | | ====Template: You add a container yourself where you define the sizing. (With bootstrap)==== |
− | [[File:Qmaze2d_howto_en_template4.png]]
| + | |
| + | <nowiki> |
| + | <!-- GET FabricJS Script Minified--> |
| + | <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/4.1.0/fabric.min.js"></script> |
| + | |
| + | <!-- GET 2D Lib Script --> |
| + | <script src="Scripts/Qmaze2dlib.js"></script> |
| + | |
| + | <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> |
| + | <canvas id="your canvas name"></canvas> |
| + | </div> |
| + | |
| + | <script> |
| + | $(document).ready(function() |
| + | { |
| + | // This function must be run per individual canvas |
| + | setcanvas('your canvas name'); |
| + | |
| + | // You can place your functions here |
| + | }); |
| + | </script> |
| + | </nowiki> |
| + | |
| <br /> | | <br /> |
| + | |
| ====Template: (OPTIONAL) Loader ==== | | ====Template: (OPTIONAL) Loader ==== |
− | [[File:Qmaze2d_howto_template5.png]]
| + | |
| + | <nowiki> |
| + | <!-- GET Preloader CSS --> |
| + | <link rel="stylesheet" href="Styles/preloader.css"/> |
| + | |
| + | <div class="preloader"> |
| + | <span class="line line-1"></span> |
| + | <span class="line line-2"></span> |
| + | <span class="line line-3"></span> |
| + | <span class="line line-4"></span> |
| + | <span class="line line-5"></span> |
| + | <span class="line line-6"></span> |
| + | <span class="line line-7"></span> |
| + | <span class="line line-8"></span> |
| + | <span class="line line-9"></span> |
| + | <div>Loading</div> |
| + | </div> |
| + | </nowiki> |
| + | |
| + | |
| | | |
| <br /><br /> | | <br /><br /> |
Line 91: |
Line 206: |
| <br /> | | <br /> |
| x3d(welcomeimg).setscale= 0.5<br /> | | x3d(welcomeimg).setscale= 0.5<br /> |
| + | <br /> |
| + | Do note that when you use the setheight and/or the setwidth function, the setscale function scales from the current sizing.<br/> |
| <br /> | | <br /> |
| Through the setscale function we made the image 0.5x of its current size.<br /> | | Through the setscale function we made the image 0.5x of its current size.<br /> |
Line 103: |
Line 220: |
| <br /> | | <br /> |
| The object that was on layer 0 is now placed into layer 1 and is therefore now above the image.<br /> | | The object that was on layer 0 is now placed into layer 1 and is therefore now above the image.<br /> |
− | | + | <br /> |
| + | There are alot of functions that alter object properties, but these only apply per individual object.. Let's make sure we optimise it a bit.<br /> |
| + | Let's say we want to add a dozen images onto the canvas each of those should be the same dimensions, ofcourse we could set setwidth and setheight for each of these objects but that's not efficient. <br /> |
| + | A better option is to use the setdefault function, this function makes it so that each object created after running this function will have the new default property. <br /> |
| + | Let's set the new width and height for every image.<br /> |
| + | You can do that like this:<br /> |
| + | <br /> |
| + | x3d(image).setdefault = height,100 <br /> |
| + | x3d(image).setdefault = height,100 <br /> |
| + | <br /> |
| + | Each image created after this function will now be 100 pixels in height and 100 pixels in width.<br /> |
| + | If you wish to change the default later on say to 50 pixels you simply call upon the function again with your new desired value.<br /> |
| + | As such:<br /> |
| + | x3d(image).setdefault = height,50 <br /> |
| + | x3d(image).setdefault = height,50 <br /> |
| + | The default width and height for images created after running this function are now 50 pixels in width and 50 pixels in height.<br /> |
| + | The setdefault function can save you alot of time if you wish to have alot of objects / images with the same properties.<br /> |
| + | <br /><br /> |
| + | These were the basic ins and outs of the Qmaze 2D library. If you wish to see a list of all functions with proper individual explanation please visit:[[Qmaze2D_How_To/en/functions|Individual function explanation]] |
| <br /><br /> | | <br /><br /> |
| | | |
Line 161: |
Line 296: |
| <br /> | | <br /> |
| setscale('welcomeimg',0.5);<br /> | | setscale('welcomeimg',0.5);<br /> |
| + | <br /> |
| + | Do note that when you use the setheight and/or the setwidth function, the setscale function scales from the current sizing.<br/> |
| <br /> | | <br /> |
| Through the setscale function we made the image 0.5x of its current size.<br /> | | Through the setscale function we made the image 0.5x of its current size.<br /> |
Line 173: |
Line 310: |
| <br /> | | <br /> |
| The object that was on layer 0 is now placed into layer 1 and is therefore now above the image.<br /> | | The object that was on layer 0 is now placed into layer 1 and is therefore now above the image.<br /> |
− |
| |
− | <br /><br />
| |
− |
| |
− | ==3a. Explanation per individual function (Rules)==
| |
− | <br />
| |
− | ===Adding / Altering (existing) objects / images:===
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name:<br />
| |
− | '''setcanvas'''<br /><br />
| |
− | Function description:<br />
| |
− | Changes the default canvas to a fabric canvas.<br /><br />
| |
− | Function structure:<br />
| |
− | x3d(object).setcanvas;<br /><br />
| |
− | Example:<br />
| |
− | x3d(c).setcanvas;<br /><br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name:<br />
| |
− | '''settext'''<br /><br />
| |
− | Function description:<br />
| |
− | Adds a text object to a canvas or changes the text of an already existent text object.<br /><br />
| |
− | Function structure:<br />
| |
− | x3d(object).settext = value<br /><br />
| |
− | Example:<br />
| |
− | x3d(welcometext).settext = Hello World!<br />
| |
− | In case a text object already exists; When the id matches that of an already existent text object,
| |
− | the text of this object is then replaced by the given value.<br />
| |
− | If you wish to split a sentence (enter), you can use \n.<br />
| |
− | An example of this: x3d('welcomeimg').settext = Hello \n World!<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name:<br />
| |
− | '''setimage'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a image to a canvas or changes the source/url or data string of an already existent image.<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | x3d(object).setimage = source/url/data-string<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | x3d(object).setimage = /Images/pug.png<br />
| |
− | In case a image already exists; When the id matches that of an already existent image,
| |
− | the source/url or datastring of this image will be replaced by the given value.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name:<br />
| |
− | '''setbgimg'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a background image to a canvas or changes the current background image, the image fills the entire canvas.<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | x3d(object).setbgimg = source/url/data-string<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | x3d(object).setbgimg = /Images/pineapples.png<br />
| |
− | In case a background image already exists; When the id matches that of an already existing background image,
| |
− | the source/url or data string of this background image will be replaced by the given value.<br />
| |
− | When you add a background image with another id whilst a background image is already active on that canvas,
| |
− | the lastest added background image will be the one shown because of the layering structure. (see setz)<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name:<br />
| |
− | '''setrectangle'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a rectangle to a canvas or changes an already existent rectangle. ( position, height and width )<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | x3d(object).setrectangle = x1,y1,x2,y2<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | x3d(newrect).setrectangle = 50,50,100,100<br />
| |
− | The rectangle in this example starts ( starting top left (0,0)) 50 pixels to the right and 50 pixels to the bottom.<br />
| |
− | In case a rectangle with this id is already existent, the locations ( and the width,height ) are changed.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name:<br />
| |
− | '''setcircle'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a circle to a canvas or changes an already existent circle. ( position and radius )<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | x3d(object).setcircle = x,y,radius<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | x3d(newcircle).setcircle = 50,50,25<br />
| |
− | The circle in this example starts ( starting top left (0,0)) 50 pixels to the right and 50 pixels to the bottom and gets a 25 pixel radius.<br />
| |
− | In case a circle with this id is already existent, the location and radius is changed.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name:<br />
| |
− | '''settriangle'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a triangle to a canvas or changes an already existent circle. ( position, height and width )<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | x3d(object).settriangle = x,y,width,height<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | x3d(newtriangle).settriangle = 50,50,75,75<br />
| |
− | The triangle in this example starts ( starting top left (0,0)) 50 pixels to the right and 50 pixels to the bottom and get a 75 pixels height and a 75 pixels width.<br />
| |
− | In case a triangle with this id is already existent, the location, height and width are changed.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name:<br />
| |
− | '''setpolygon'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a polygon to a canvas or changes an already existent polygon, the begin and endpoint always connect. ( positions)<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | x3d(object).setpolygon = x1,y1,x2,y2 etc.<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | x3d(newpoly).setpolygon = 20,0,40,50,60,80,40,70,20,60<br />
| |
− | The polygon in this example starts ( starting top left (0,0)) 20 pixels to the right and 0 pixels to the bottom, the second point is 40 pixels to the right and 50 pixels to the bottom etc.<br />
| |
− | The end of the polygon always connects with the beginpoint.<br />
| |
− | In case a triangle with this id is already existent, the points get changed.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name:<br />
| |
− | '''setarrows'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a line to the canvas with 2 arrowpoints or replaces an already existing arrow/line.<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | x3d(object).setarrows = x1,y1,x2,y2<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | x3d(newarrow).setarrows = 100,100,300,300<br />
| |
− | The arrow in this example starts ( starting top left (0,0)) 100 pixels to the right and 100 pixels to the bottom and stops 300 pixels to the right and 300 pixels to the bottom.<br />
| |
− | In case a arrow with this id is already existent (setline,setarrow,setarrows), the positions are replaced with the given value and if required arrowpoints are added/removed.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name:<br />
| |
− | '''setarrow'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a line to a canvas with 1 arrowpoint or replaces an already existing arrow/line.<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | x3d(object).setarrow = x1,y1,x2,y2<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | x3d(object).setarrows = 100,100,300,300<br />
| |
− | The arrow in this example starts ( starting top left (0,0)) 100 pixels to the right and 100 pixels to the bottom and stops 300 pixels to the right and 300 pixels to the bottom.<br />
| |
− | In case a arrow with this id is already existent (setline,setarrow,setarrows), the positions are replaced with the given value and if required arrowpoints are added/removed.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name:<br />
| |
− | '''setline'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a line to a canvas or replaces an already existing arrow/line.<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | x3d(object).setline = x1,y1,x2,y2<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | x3d(object).setline = 100,100,300,300<br />
| |
− | The arrow in this example starts ( starting top left (0,0)) 100 pixels to the right and 100 pixels to the bottom and stops 300 pixels to the right and 300 pixels to the bottom.<br />
| |
− | In case a arrow with this id is already existent (setline,setarrow,setarrows), the positions are replaced with the given value and if required arrowpoints are added/removed.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | ===Altering existent objects / images===
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setcolor'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the color of an object.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setcolor = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcometext).setcolor = red<br />
| |
− | When the object is a canvas the background color is changed to the given value.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setdraggable'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the object to be static or dynamic ( user interaction )<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setdraggable = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).setdraggable = 1<br />
| |
− | The value can either be 1 or 0, where 0 makes the object static and 1 makes the object draggable.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setanimationduration'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the duration of animations.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setanimationduration = duration<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(object).setanimationduration = 1000<br />
| |
− | In this example the animation duration is set to 1000ms (1 second).<br />
| |
− | The animation duration counts for all animations untill it is altered again.<br />
| |
− |
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setanimationtype'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes which animation is played when positions change.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setanimationtype = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(object).setanimationtype = easeInOutBounce<br />
| |
− | In this example the animation type is set to InOutBounce, this makes the object 'bounce' at the end of an position change.<br />
| |
− | The animation type counts for all animations untill it is altered again.<br />
| |
− |
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''sethandles'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the handles of an object depended on the value.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).sethandles = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(newrect).sethandles = newrect<br />
| |
− | Changes which lines and or user interactive corners are visible.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''sethandlecolor'''<br />
| |
| <br /> | | <br /> |
− | Function description: <br />
| + | There are alot of functions that alter object properties, but these only apply per individual object.. Let's make sure we optimise it a bit.<br /> |
− | Changes the color of the handles.<br />
| + | Let's say we want to add a dozen images onto the canvas each of those should be the same dimensions, ofcourse we could set setwidth and setheight for each of these objects but that's not efficient. <br /> |
| + | A better option is to use the setdefault function, this function makes it so that each object created after running this function will have the new default property. <br /> |
| + | Let's set the new width and height for every image.<br /> |
| + | You can do that like this:<br /> |
| <br /> | | <br /> |
− | Function structure: <br />
| + | setdefault('image','height,100');<br /> |
− | x3d(object).sethandlecolor = value<br />
| + | setdefault('image','width,100');<br /> |
| <br /> | | <br /> |
− | Example: <br />
| + | Each image created after this function will now be 100 pixels in height and 100 pixels in width.<br /> |
− | x3d(newrect).sethandlecolor = red<br />
| + | If you wish to change the default later on say to 50 pixels you simply call upon the function again with your new desired value.<br /> |
− | | + | As such:<br /> |
− | <br /><br />
| + | setdefault('image','height,50');<br /> |
− | | + | setdefault('image','width,50');<br /> |
− | Function name: <br />
| + | The default width and height for images created after running this function are now 50 pixels in width and 50 pixels in height.<br /> |
− | '''setheight'''<br />
| + | The setdefault function can save you alot of time if you wish to have alot of objects / images with the same properties.<br /> |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the height of an object in pixels.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setheight = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).setheight = 150<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setwidth'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the width of an object in pixels.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setwidth = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).setwidth = 250<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setscale'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the width and height of an object or image by scale.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setscale = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).setscale = 0.8<br />
| |
− | The value represents the scale on which the object / image is scaled. ( x and y axle )<br />
| |
− | The value 1 is the original value.<br />
| |
− |
| |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setid'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the id of an already existent object / image.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setid = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).setid = goodbyeimg<br />
| |
− | The object is the id of an object that is to be changed, the value is to become the new id. The new id must not be existent on the canvas.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setlineheight'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes how much height is between text lines.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setlineheight = value<br />
| |
− | <br />
| |
− | Example:
| |
− | x3d(welcometext).setlineheight = 10
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setrotation'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the rotation of an object / image.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setrotation = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).setrotation = 90<br />
| |
− | The value is the rotation starting from the original rotationpoint (0) in degrees. (celcius)<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setx'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the position of an object / image on the x-axle. (in pixels where the left is 0)<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setx = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).setx = 500<br />
| |
− | The image in this example will now be placed 500 pixels to the right.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''sety'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the position of an object / image on the y-axle. (in pixels where the top is 0)<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).sety = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).sety = 200<br />
| |
− | The image in this example will now be placed 200 pixels to the bottom.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setz'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes on which layer the object / image resides. ( where 0 is in the back )<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setz = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).setz = 10<br />
| |
− | The value is the layer on which the object / image is placed, where the layer 0 is in the back.<br />
| |
− | The object / image that is already active on the chosen layer will be placed 1 place higher into the layers.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setstroke'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the stroke of an object.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setstroke = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(newrect).setstroke = 20<br />
| |
− | The object gets a line around the object with the size of the value in pixels.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setstrokecolor'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the color of the objects' stroke.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setstrokecolor = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(newrect).setstrokecolor = blue<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''settextfont'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the text font of an text object.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).settextfont = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcometext).settextfont = Arial<br />
| |
− | The text font must exist, if this is not the case the text font will remain the same. Attention: Case sensitive!<br />
| |
− | You can download text fonts directly from fonts.google.com or through a url link.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''settextsize'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the text size of a text object.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).settextsize = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcometext).settextsize = 20<br />
| |
− | The value is the text size in pixels.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''settextweight'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the boldness of an text object.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).settextweight = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcometext).settextweight = 400<br />
| |
− | Possible values: light, normal, bold, number.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setvisible'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the visibility of an object / image / canvas.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setvisible = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcometext).setvisible = 0.7<br />
| |
− | To make the canvas visible or invisible the value must be either 1 or 0 where 0 makes it invisible and 1 makes it visible.<br />
| |
− | To make an object / image visible or invisible the value must be between 0 and 1, where 1 is visible and 0 is invisible, decimals may be used.<br />
| |
− | | |
− | <br /><br />
| |
− |
| |
− | Function name:<br />
| |
− | '''setflipx'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Flips the object / image around. (Horizontally)<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setflipx = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).setflipx = true<br />
| |
− | The 'value' true flips the object / image around from it original stance, the value 'false' changes it back to it's original stance.<br />
| |
− | The value 'flip' makes the object / image flip around no matter which stance it currently is.<br />
| |
− |
| |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setflipy'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Flips the object / image around. (Vertically)<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setflipy = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).setflipy = flip<br />
| |
− | The 'value' true flips the object / image around from it original stance, the value 'false' changes it back to it's original stance.<br />
| |
− | The value 'flip' makes the object / image flip around no matter which stance it currently is.<br />
| |
− |
| |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setdefault'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the default properties of which an object / image is loaded in with.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setdefault = property,propertyvalue<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(text).setdefault = fill,red<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | ===Retrieving object / imag properties===
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''getproperty'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the chosen property (value) of the object / image.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).getproperty = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).getproperty = top<br />
| |
− | The value is the property you wish to retrieve.<br />
| |
− |
| |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''getx'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the x-axle value from the object / image.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).getx<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).getx<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''gety'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the y-axle value from the object / image.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).gety<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).gety<br />
| |
− |
| |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''getz'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the layer on which the object / images resides.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).getz<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).getz<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''getscale'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the objects scale (X&Y combined)<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).getscale<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).getscale<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''getscalex'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the objects x-axle scale.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).getscalex<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).getscalex<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''getscaley'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the objects y-axle scale.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).getscalex<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).getscalex<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | ===Other functions===
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''copy'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Copies the chosen object / image and gives it a new id.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).copy = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).copy = newimage<br />
| |
− | The new id (value) must be unique. (can't already exist)<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''delete'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Deletes the chosen object / image from the canvas.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).delete<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(newimage).delete<br />
| |
− | To use this function, you only need to enter a object(id).<br />
| |
− | | |
− | | |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''clearcanvas'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Removes all objects and images from the canvas.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).clearcanvas<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(c).clearcanvas<br />
| |
− | To use this function, you only need to enter a object(id).<br />
| |
− | The object(id) in this case is that of the canvas.<br />
| |
− |
| |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''screenshot'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Makes a screenshot of the chosen canvas.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).screenshot<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(c).screenshot<br />
| |
− | To use this function, you only need to enter a object(id).<br />
| |
− | The object(id) in this case is that of the canvas.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | ==3b. Explanation per individual function (Outputscript)==
| |
− | <br />
| |
− | ===Adding / Altering (existing) objects / images:===
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name:<br />
| |
− | '''setcanvas'''<br /><br />
| |
− | Function description:<br />
| |
− | Changes the default canvas to a fabric canvas.<br /><br />
| |
− | Function structure:<br />
| |
− | setcanvas('object');<br /><br />
| |
− | Example:<br />
| |
− | setcanvas('c');<br /><br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name:<br />
| |
− | '''settext'''<br /><br />
| |
− | Function description:<br />
| |
− | Adds a text object to a canvas or changes the text of an already existent text object.<br /><br />
| |
− | Function structure:<br />
| |
− | settext ('object','value');<br /><br />
| |
− | Example:<br />
| |
− | settext('welcometext','Hello World!');<br />
| |
− | In case a text object already exists; When the id matches that of an already existent text object,
| |
− | the text of this object is then replaced by the given value.<br />
| |
− | If you wish to split a sentence (enter), you can use \n.<br />
| |
− | An example of this: x3d('welcomeimg').settext = Hello \n World!<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name:<br />
| |
− | '''setimage'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a image to a canvas or changes the source/url or data string of an already existent image.<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | setimage('object ','source/url/data-string');<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | setimage('welcomeimg','/Images/pug.png');<br />
| |
− | In case a image already exists; When the id matches that of an already existent image,
| |
− | the source/url or datastring of this image will be replaced by the given value.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name:<br />
| |
− | '''setbgimg'''<br /> | |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a background image to a canvas or changes the current background image, the image fills the entire canvas.<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | setbgimg('object','source/url/data-string');<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | setbgimg('bgimg','/Images/pineapples.png');<br />
| |
− | In case a background image already exists; When the id matches that of an already existing background image,
| |
− | the source/url or data string of this background image will be replaced by the given value.<br />
| |
− | When you add a background image with another id whilst a background image is already active on that canvas,
| |
− | the lastest added background image will be the one shown because of the layering structure. (see setz)<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name:<br />
| |
− | '''setrectangle'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a rectangle to a canvas or changes an already existent rectangle. ( position, height and width )<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | setrectangle('object','x1,y1,x2,y2');<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | setrectangle('newrect' , '50,50,100,100');<br />
| |
− | The rectangle in this example starts ( starting top left (0,0)) 50 pixels to the right and 50 pixels to the bottom.<br />
| |
− | In case a rectangle with this id is already existent, the locations ( and the width,height ) are changed.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name:<br />
| |
− | '''setcircle'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a circle to a canvas or changes an already existent circle. ( position and radius )<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | setcircle('object','x,y,radius');<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | setcircle('newcircle','50,50,25');<br />
| |
− | The circle in this example starts ( starting top left (0,0)) 50 pixels to the right and 50 pixels to the bottom and gets a 25 pixel radius.<br /> | |
− | In case a circle with this id is already existent, the location and radius is changed.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name:<br />
| |
− | '''settriangle'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a triangle to a canvas or changes an already existent circle. ( position, height and width )<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | settriangle ('object','x,y,width,height');<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | settriangle('newtriangle',50,50,75,75');<br />
| |
− | The triangle in this example starts ( starting top left (0,0)) 50 pixels to the right and 50 pixels to the bottom and get a 75 pixels height and a 75 pixels width.<br />
| |
− | In case a triangle with this id is already existent, the location, height and width are changed.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name:<br />
| |
− | '''setpolygon'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a polygon to a canvas or changes an already existent polygon, the begin and endpoint always connect. ( positions)<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | setpolygon('object','x1,y1,x2,y2 etc.');<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | setpolygon('newpoly','20,0,40,50,60,80,40,70,20,60');<br />
| |
− | The polygon in this example starts ( starting top left (0,0)) 20 pixels to the right and 0 pixels to the bottom, the second point is 40 pixels to the right and 50 pixels to the bottom etc.<br />
| |
− | The end of the polygon always connects with the beginpoint.<br />
| |
− | In case a triangle with this id is already existent, the points get changed.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name:<br />
| |
− | '''setarrows'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a line to the canvas with 2 arrowpoints or replaces an already existing arrow/line.<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | setarrows('object','x1,y1,x2,y2');<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | setarrows('newarrow','100,100,300,300');<br />
| |
− | The arrow in this example starts ( starting top left (0,0)) 100 pixels to the right and 100 pixels to the bottom and stops 300 pixels to the right and 300 pixels to the bottom.<br />
| |
− | In case a arrow with this id is already existent (setline,setarrow,setarrows), the positions are replaced with the given value and if required arrowpoints are added/removed.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name:<br />
| |
− | '''setarrow'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a line to a canvas with 1 arrowpoint or replaces an already existing arrow/line.<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | setarrow('object','x1,y1,x2,y2');<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | setarrows('newdbarrow','100,100,300,300');<br />
| |
− | The arrow in this example starts ( starting top left (0,0)) 100 pixels to the right and 100 pixels to the bottom and stops 300 pixels to the right and 300 pixels to the bottom.<br />
| |
− | In case a arrow with this id is already existent (setline,setarrow,setarrows), the positions are replaced with the given value and if required arrowpoints are added/removed.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name:<br />
| |
− | '''setline'''<br />
| |
− | <br />
| |
− | Function description:<br />
| |
− | Adds a line to a canvas or replaces an already existing arrow/line.<br />
| |
− | <br />
| |
− | Function structure:<br />
| |
− | setline('object','x1,y1,x2,y2');<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | setline('newline','100,100,300,300');<br />
| |
− | The arrow in this example starts ( starting top left (0,0)) 100 pixels to the right and 100 pixels to the bottom and stops 300 pixels to the right and 300 pixels to the bottom.<br /> | |
− | In case a arrow with this id is already existent (setline,setarrow,setarrows), the positions are replaced with the given value and if required arrowpoints are added/removed.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | ===Altering existent objects / images===
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setcolor'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the color of an object.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setcolor('object','value');<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | setcolor('welcometext','red');<br />
| |
− | When the object is a canvas the background color is changed to the given value.<br />
| |
− |
| |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setdraggable'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the object to be static or dynamic ( user interaction )<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setdraggable('object',value);<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | setdraggable('object',1);<br />
| |
− | The value can either be 1 or 0, where 0 makes the object static and 1 makes the object draggable.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setanimationduration'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the duration of animations.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setanimationduration(duration);<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | setanimationduration(1000);<br />
| |
− | In this example the animation duration is set to 1000ms (1 second).<br />
| |
− | The animation duration counts for all animations untill it is altered again.<br />
| |
− |
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setanimationtype'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes which animation is played when positions change.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setanimationtype('value');<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | setanimationtype('easeInOutBounce');<br />
| |
− | In this example the animation type is set to InOutBounce, this makes the object 'bounce' at the end of an position change.<br />
| |
− | The animation type counts for all animations untill it is altered again.<br />
| |
− |
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''sethandles'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the handles of an object depended on the value.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | sethandles('object',value);<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | sethandles('newrect',1);<br />
| |
− | Changes which lines and or user interactive corners are visible.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''sethandlecolor'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the color of the handles.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | sethandlecolor('object','value');<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | sethandlecolor('newrect','red');<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setheight'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the height of an object in pixels.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setheight('object',value);<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | setheight('welcomeimg',150);<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setwidth'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the width of an object in pixels.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setwidth('object',value);<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | setwidth('welcomeimg',250);<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setscale'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the width and height of an object or image by scale.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setscale('object',value);<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | setscale('welcomeimg',0.8);<br />
| |
− | The value represents the scale on which the object / image is scaled. ( x and y axle )<br />
| |
− | The value 1 is the original value.<br />
| |
− |
| |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setid'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the id of an already existent object / image.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setid('object','value');<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | setid('welcomeimg','goodbyeimg');<br />
| |
− | The object is the id of an object that is to be changed, the value is to become the new id. The new id must not be existent on the canvas.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setlineheight'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes how much height is between text lines.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setlineheight('object',value);<br />
| |
− | <br />
| |
− | Example:<br />
| |
− | setlineheight('welcometext',10);<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setrotation'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the rotation of an object / image.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setrotation('object',value);<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | setrotation('welcomeimg',90);<br />
| |
− | The value is the rotation starting from the original rotationpoint (0) in degrees. (celcius)<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setx'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the position of an object / image on the x-axle. (in pixels where the left is 0)<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setx('object',value);<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | setx('welcomeimg',500);<br />
| |
− | The image in this example will now be placed 500 pixels to the right.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''sety'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the position of an object / image on the y-axle. (in pixels where the top is 0)<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | sety('object',value);<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | sety('welcomeimg',200);<br />
| |
− | The image in this example will now be placed 200 pixels to the bottom.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setz'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes on which layer the object / image resides. ( where 0 is in the back )<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setz('object',value);<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | setz('welcomeimg',10);<br />
| |
− | The value is the layer on which the object / image is placed, where the layer 0 is in the back.<br />
| |
− | The object / image that is already active on the chosen layer will be placed 1 place higher into the layers.<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setstroke'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the stroke of an object.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setstroke('object',value);<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | setstroke('newrect',20);<br />
| |
− | The object gets a line around the object with the size of the value in pixels.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setstrokecolor'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the color of the objects' stroke.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | setstrokecolor('object','value');<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | setstrokecolor('newrect','blue');<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''settextfont'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the text font of an text object.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | settextfont('object','value');<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | settextfont('welcometext','Arial');<br />
| |
− | The text font must exist, if this is not the case the text font will remain the same. Attention: Case sensitive!<br />
| |
− | You can download text fonts directly from fonts.google.com or through a url link.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''settextsize'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the text size of a text object.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | settextsize('object',value);<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | settextsize('welcometext',20);<br />
| |
− | The value is the text size in pixels.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''settextweight'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the boldness of an text object.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | settextweight('object','value');<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | settextweight('welcometext',400);<br />
| |
− | Possible values: light, normal, bold, number.<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''setvisible'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the visibility of an object / image / canvas.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setvisible = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcometext).setvisible = 0.7<br />
| |
− | To make the canvas visible or invisible the value must be either 1 or 0 where 0 makes it invisible and 1 makes it visible.<br />
| |
− | To make an object / image visible or invisible the value must be between 0 and 1, where 1 is visible and 0 is invisible, decimals may be used.<br />
| |
− | | |
− | <br /><br />
| |
− |
| |
− | Function name:<br />
| |
− | '''setflipx'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Flips the object / image around. (Horizontally)<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setflipx = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).setflipx = true<br />
| |
− | The 'value' true flips the object / image around from it original stance, the value 'false' changes it back to it's original stance.<br />
| |
− | The value 'flip' makes the object / image flip around no matter which stance it currently is.<br />
| |
− |
| |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setflipy'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Flips the object / image around. (Vertically)<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setflipy = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).setflipy = flip<br />
| |
− | The 'value' true flips the object / image around from it original stance, the value 'false' changes it back to it's original stance.<br />
| |
− | The value 'flip' makes the object / image flip around no matter which stance it currently is.<br />
| |
− |
| |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''setdefault'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Changes the default properties of which an object / image is loaded in with.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).setdefault = property,propertyvalue<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(text).setdefault = fill,red<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | ===Retrieving object / imag properties===
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''getproperty'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the chosen property (value) of the object / image.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).getproperty = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).getproperty = top<br />
| |
− | The value is the property you wish to retrieve.<br />
| |
− |
| |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''getx'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the x-axle value from the object / image.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).getx<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).getx<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''gety'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the y-axle value from the object / image.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).gety<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).gety<br />
| |
− |
| |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''getz'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the layer on which the object / images resides.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).getz<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).getz<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''getscale'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the objects scale (X&Y combined)<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).getscale<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).getscale<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''getscalex'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the objects x-axle scale.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).getscalex<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).getscalex<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''getscaley'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Gets the objects y-axle scale.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).getscalex<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).getscalex<br />
| |
− | | |
− | <br /><br />
| |
− | | |
− | ===Other functions===
| |
− | | |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''copy'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Copies the chosen object / image and gives it a new id.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).copy = value<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(welcomeimg).copy = newimage<br />
| |
− | The new id (value) must be unique. (can't already exist)<br />
| |
− |
| |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''delete'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Deletes the chosen object / image from the canvas.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).delete<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(newimage).delete<br />
| |
− | To use this function, you only need to enter a object(id).<br />
| |
− | | |
− | | |
− | <br /><br />
| |
− |
| |
− | Function name: <br />
| |
− | '''clearcanvas'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Removes all objects and images from the canvas.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).clearcanvas<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(c).clearcanvas<br />
| |
− | To use this function, you only need to enter a object(id).<br />
| |
− | The object(id) in this case is that of the canvas.<br />
| |
− |
| |
− | <br /><br />
| |
− | | |
− | Function name: <br />
| |
− | '''screenshot'''<br />
| |
− | <br />
| |
− | Function description: <br />
| |
− | Makes a screenshot of the chosen canvas.<br />
| |
− | <br />
| |
− | Function structure: <br />
| |
− | x3d(object).screenshot<br />
| |
− | <br />
| |
− | Example: <br />
| |
− | x3d(c).screenshot<br />
| |
− | To use this function, you only need to enter a object(id).<br />
| |
− | The object(id) in this case is that of the canvas.<br />
| |
− | | |
| <br /><br /> | | <br /><br /> |
| + | These were the basic ins and outs of the Qmaze 2D library. If you wish to see a list of all functions with proper individual explanation please visit:[[Qmaze2D_How_To/en/functions|Individual function explanation]] |