Difference between revisions of "Qmaze2D How To/en"

From QmazeWiki
Jump to: navigation, search
 
(44 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_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_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)====
 +
 +
<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 />
 +
 
====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_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 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: You add a container yourself where you define the sizing. (Without bootstrap)====
+
 
[[File:Qmaze2d_howto_template4.png]]
+
====Template: (OPTIONAL) Loader ====
<br />
+
 
====Template: (OPTION) Loader ====
+
<nowiki>
[[File:Qmaze2d_howto_template5.png]]
+
<!-- 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 />
 
<br />
===Adding / Altering (existing) objects / images:===
+
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 />
<br /><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 />
Function name:<br />
+
You can do that like this:<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 />
 
<br />
Function description:<br />
+
setdefault('image','height,100');<br />
Adds a background image to a canvas or changes the current background image, the image fills the entire canvas.<br />
+
setdefault('image','width,100');<br />
 
<br />
 
<br />
Function structure:<br />
+
Each image created after this function will now be 100 pixels in height and 100 pixels in width.<br />
x3d(object).setbgimg = source/url/data-string<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 />
<br />
+
As such:<br />
Example:<br />
+
setdefault('image','height,50');<br />
x3d(object).setbgimg = /Images/pineapples.png<br />
+
setdefault('image','width,50');<br />
In case a background image already exists; When the id matches that of an already existing background image,
+
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 source/url or data string of this background image will be replaced by the given value.<br />
+
The setdefault function can save you alot of time if you wish to have alot of objects / images with the same properties.<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 />
 
Function description: <br />
 
Changes the color of the handles.<br />
 
<br />
 
Function structure: <br />
 
x3d(object).sethandlecolor = value<br />
 
<br />
 
Example: <br />
 
x3d(newrect).sethandlecolor = 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 />
 
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 />
 
Haalt de gekozen eigenschap (waarde) op van het object / de afbeelding.<br />
 
<br />
 
Function structure: <br />
 
x3d(object).getproperty = waarde<br />
 
<br />
 
Example: <br />
 
x3d(welcomeimg).getproperty = top<br />
 
De waarde is de eigenschap die u op wilt halen.<br />
 
 
<br /><br />
 
 
 
Function name: <br />
 
'''getx'''<br />
 
<br />
 
Function description: <br />
 
Haalde de x-waarde op van het object.<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 />
 
Haalde de y-waarde op van het object.<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 />
 
Haalde de laag op waarin het object zich bevind.<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 />
 
Haalt de schaal op van het object.<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 />
 
Haalt de x-schaal op van het object.<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 />
 
Haalt de y-schaal op van het object.<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 />
 
Kopieert het gekozen object / afbeelding en geeft deze een nieuw id.<br />
 
<br />
 
Function structure: <br />
 
x3d(object).copy = waarde<br />
 
<br />
 
Example: <br />
 
x3d(welcomeimg).copy = newimage<br />
 
Het nieuwe id (waarde) moet uniek zijn.<br />
 
 
<br /><br />
 
 
Function name: <br />
 
'''delete'''<br />
 
<br />
 
Function description: <br />
 
Verwijderd het gekozen object / afbeelding van het canvas.<br />
 
<br />
 
Function structure: <br />
 
x3d(object).delete<br />
 
<br />
 
Example: <br />
 
x3d(newimage).delete<br />
 
Bij deze functie dient enkel een object(id) meegegeven te worden.<br />
 
 
 
<br /><br />
 
 
Function name: <br />
 
'''clearcanvas'''<br />
 
<br />
 
Function description: <br />
 
Verwijderd alle objecten en afbeeldingen uit het gekozen canvas.<br />
 
<br />
 
Function structure: <br />
 
x3d(object).clearcanvas<br />
 
<br />
 
Example: <br />
 
x3d(c).clearcanvas<br />
 
Bij deze functie dient enkel een object(id) meegegeven te worden.<br />
 
Het object(id) is in dit geval dat van een canvas.<br />
 
 
<br /><br />
 
 
 
Function name: <br />
 
'''screenshot'''<br />
 
<br />
 
Function description: <br />
 
Maakt een scherm afdruk van een canvas.<br />
 
<br />
 
Function structure: <br />
 
x3d(object).screenshot<br />
 
<br />
 
Example: <br />
 
x3d(c).screenshot<br />
 
Bij deze functie dient enkel een object(id) meegegeven te worden.<br />
 
Het object(id) is in dit geval dat van een canvas.<br />
 
 
 
<br /><br />
 
 
 
==3b. Explanation per individual function (Outputscript)==
 
<br />
 
===Adding / Altering (existing) objects / images===
 
 
 
<br /><br />
 
 
 
Functienaam:<br />
 
'''setcanvas'''<br /><br />
 
Functie beschrijving:<br />
 
Veranderd een standaard canvas tot een fabric canvas.<br /><br />
 
Functie opbouw:<br />
 
setcanvas('object');<br /><br />
 
Voorbeeld:<br />
 
setcanvas('c');<br /><br />
 
 
 
<br /><br />
 
 
 
Functienaam:<br />
 
'''settext'''<br /><br />
 
Functie beschrijving:<br />
 
Voegt een tekst object toe of vervangt de tekst van een al bestaande tekst object.<br /><br />
 
Functie opbouw:<br />
 
settext ('object','waarde');<br /><br />
 
Voorbeeld:<br />
 
settext('welcometext','Hello World!');<br />
 
Indien een tekst object al bestaat; Wanneer het id overeenkomt met dat van een al bestaand tekst object,
 
word de tekst hiervan vervangen door de door uw opgegeven waarde.<br />
 
Indien u een zin wil splitsen (enter), kunt u gebruik maken van \n.<br />
 
Een voorbeeld hiervan: x3d(welcomeimg).settext = Hello \n World!<br />
 
 
 
<br /><br />
 
 
 
Functienaam:<br />
 
'''setimage'''<br />
 
<br />
 
Functie beschrijving:<br />
 
Voegt een afbeelding toe of vervangt de source/url of data string van een al bestaande afbeelding<br />
 
<br />
 
Functie opbouw:<br />
 
setimage('object ','source/url/data-string');<br />
 
<br />
 
Voorbeeld:<br />
 
setimage('welcomeimg','/Images/pug.png');<br />
 
Indien een afbeelding al bestaat; Wanneer het id overeenkomt met dat van een al bestaande afbeelding,
 
Word de source/url of datastring vervangen door de door uw opgegeven waarde.<br />
 
 
 
<br /><br />
 
 
 
Functienaam:<br />
 
'''setbgimg'''<br />
 
<br />
 
Functie beschrijving:<br />
 
Voegt een achtergrond afbeelding toe of vervangt de huidige achtergrond afbeelding, de afbeelding vult het hele canvas.<br />
 
<br />
 
Functie opbouw:<br />
 
setbgimg('object','source/url/data-string');<br />
 
<br />
 
Voorbeeld:<br />
 
setbgimg('bgimg','/Images/pineapples.png');<br />
 
Indien een achtergrond afbeelding al bestaat; Wanneer het id overeenkomt met dat van een al bestaande achtergrond afbeelding,
 
word de source/url of data string vervangen door de door uw opgegeven waarde.<br />
 
Indien u een achtergrond afbeelding toe voegt met een ander id terwijl er al een actief is word de laatst aangeroepen achtergrond afbeelding,
 
de achtergrondafbeelding die u zult zien i.v.m. de lagen structuur. ( zie setz )<br />
 
 
 
<br /><br />
 
 
 
Functienaam:<br />
 
'''setrectangle'''<br />
 
<br />
 
Functie beschrijving:<br />
 
Voegt een vierkant/rechthoek toe of past een al bestaande vierkant/rechthoek aan. ( positie , grootte en hoogte )<br />
 
<br />
 
Functie opbouw:<br />
 
setrectangle('object','x1,y1,x2,y2');<br />
 
<br />
 
Voorbeeld:<br />
 
setrectangle('newrect' , '50,50,100,100');<br />
 
De rectangle begint in dit voorbeeld (vanaf linksboven (0,0)) 50 pixels naar rechts en 50 pixels naar beneden. <br />
 
Indien er al een rectangle is met dit id worden de locaties ( en dus ook de grootte en hoogte ) vervangen.<br />
 
 
 
<br /><br />
 
 
 
Functienaam:<br />
 
'''setcircle'''<br />
 
<br />
 
Functie beschrijving:<br />
 
Voegt een cirkel toe of past een al bestaande cirkel aan. ( positie en radius )<br />
 
<br />
 
Functie opbouw: <br />
 
setcircle('object','x,y,radius');<br />
 
<br />
 
Voorbeeld:<br />
 
setcircle('newcircle','50,50,25');<br />
 
De cirkel begint in dit geval (vanaf linksboven (0,0)) 50 pixels naar rechts en 50 pixels naar beneden en krijgt een radius van 25 pixels.<br />
 
Indien er al een cirkel is met dit id worden de locaties en de radius vervangen.<br />
 
 
 
<br /><br />
 
 
 
Functienaam:<br />
 
'''settriangle'''<br />
 
<br />
 
Functie beschrijving:<br />
 
Voegt een driehoek toe of past een al bestaande driehoek aan. ( positie , grootte en hoogte )<br />
 
<br />
 
Functie opbouw: <br />
 
settriangle ('object','x,y,width,height');<br />
 
<br />
 
Voorbeeld: <br />
 
settriangle('newtriangle',50,50,75,75');<br />
 
De driehoek begint in dit geval (vanaf linksboven (0,0)) 50 pixels naar rechts en 50 pixels naar beneden en krijgt een hoogte van 75 pixels en een breedte van 75 pixels.<br />
 
Indien er al een driehoek is met dit id worden de locaties, de hoogte en de breedte vervangen.<br />
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setpolygon'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Voegt een polygon toe of past een al bestaande cirkel aan, het eindpunt verbind altijd met het beginpunt. ( posities )<br />
 
<br />
 
Functie opbouw: <br />
 
setpolygon('object','x1,y1,x2,y2 etc.');<br />
 
<br />
 
Voorbeeld: <br />
 
setpolygon('newpoly','20,0,40,50,60,80,40,70,20,60');<br />
 
De polygon begint in dit geval (vanaf linksboven (0,0)) 20 pixels naar rechts en 0 pixels naar beneden, het 2e punt is 40 pixels naar rechts en 50 pixels naar beneden etc.<br />
 
Het einde van de polygon verbind automatisch met het beginpunt.<br />
 
Indien er al een polygon is met dit id worden de punten vervangen.<br />
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setarrows'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Voegt een lijn toe met 2 pijlpunten of vervangt een al bestaande pijl/lijn.<br />
 
<br />
 
Functie opbouw: <br />
 
setarrows('object','x1,y1,x2,y2');<br />
 
<br />
 
Voorbeeld: <br />
 
setarrows('newarrow','100,100,300,300');<br />
 
De pijl begint in dit geval  (vanaf linksboven (0,0)) 100 pixels naar rechts en 100 pixels naar beneden, en eindigt 300 pixels naar rechts en 300 pixels naar beneden.<br />
 
Indien er al een pijl/lijn bestaat met dit id ( via setarrows,setarrow of setline) worden de posities hiervan vervangen,
 
en indien van toepassing verdwijnen er pijlen of worden er pijlen toegevoegd.<br />
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setarrow'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Voegt een lijn toe met 1 pijlpunt of vervangt een al bestaande pijl/lijn.<br />
 
<br />
 
Functie opbouw: <br />
 
setarrow('object','x1,y1,x2,y2');<br />
 
<br />
 
Voorbeeld: <br />
 
setarrows('newdbarrow','100,100,300,300');<br />
 
De pijl begint in dit geval  (vanaf linksboven (0,0)) 100 pixels naar rechts en 100 pixels naar beneden, en eindigt 300 pixels naar rechts en 300 pixels naar beneden.<br />
 
Indien er al een pijl/lijn bestaat met dit id ( via setarrows,setarrow of setline) worden de posities hiervan vervangen,
 
en indien van toepassing verdwijnen er pijlen of worden er pijlen toegevoegd.<br />
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setline'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Voegt een lijn toe of vervangt een al bestaande pijl/lijn.<br />
 
<br />
 
Functie opbouw: <br />
 
setline('object','x1,y1,x2,y2');<br />
 
<br />
 
Voorbeeld: <br />
 
setline('newline','100,100,300,300');<br />
 
De lijn begint in dit geval  (vanaf linksboven (0,0)) 100 pixels naar rechts en 100 pixels naar beneden, en eindigt 300 pixels naar rechts en 300 pixels naar beneden.<br />
 
Indien er al een pijl/lijn bestaat met dit id ( via setarrows,setarrow of setline) worden de posities hiervan vervangen,
 
en indien van toepassing verdwijnen er pijlen of worden er pijlen toegevoegd.<br />
 
<br /><br />
 
 
 
===Altering existent objects / images===
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setcolor'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de kleur van een object.<br />
 
<br />
 
Functie opbouw: <br />
 
setcolor('object','waarde');<br />
 
<br />
 
Voorbeeld: <br />
 
setcolor('welcometext','red');<br />
 
Wanneer het object een canvas is word de achtergrond kleur veranderd naar de waarde.<br />
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setdraggable'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Veranderd het object tot statisch of dynamisch. ( Gebruiker interactie )<br />
 
<br />
 
Functie opbouw: <br />
 
setdraggable('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
setdraggable('object',1);<br />
 
De waarde kan 1 of 0 zijn waarin 0 het object statisch maakt en 1 het object sleepbaar maakt.<br />
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setanimationduration'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de duratie van animaties.<br />
 
<br />
 
Functie opbouw: <br />
 
setanimationduration(duratie);<br />
 
<br />
 
Voorbeeld: <br />
 
setanimationduration(1000);<br />
 
In dit voorbeeld is de animatie duratie op 1000ms (1 seconde) gezet.<br />
 
De animatieduratie geldt voor alle animaties tot het weer aangepast word.<br />
 
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setanimationtype'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt welke animatie uitgevoerd word bij positie wijzigingen. (setx,sety en setrotation)<br />
 
<br />
 
Functie opbouw: <br />
 
setanimationtype('waarde');<br />
 
<br />
 
Voorbeeld: <br />
 
setanimationtype('easeInOutBounce');<br />
 
In dit voorbeeld is het animatie type op InOutBounce gezet, dit zorgt ervoor dat het object 'stuitert' aan het einde van de positie wijziging.<br />
 
Het animatie type geldt hierna voor alle animaties tot het weer aangepast word.<br />
 
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''sethandles'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de handles van een object gebaseerd op de waarde.<br />
 
<br />
 
Functie opbouw: <br />
 
sethandles('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
sethandles('newrect',1);<br />
 
Wijzigt welke uitlijning en/of gebruiker interactieve blokjes aanwezig zijn.<br />
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''sethandlecolor'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de kleur van de handlers.<br />
 
<br />
 
Functie opbouw: <br />
 
sethandlecolor('object','waarde');<br />
 
<br />
 
Voorbeeld: <br />
 
sethandlecolor('newrect','red');<br />
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setheight'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de hoogte van een object in pixels.<br />
 
<br />
 
Functie opbouw: <br />
 
setheight('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
setheight('welcomeimg',150);<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''setwidth'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de breedte van een object in pixels.<br />
 
<br />
 
Functie opbouw: <br />
 
setwidth('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
setwidth('welcomeimg',250);<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''setscale'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de hoogte en breedte van een object of afbeelding d.m.v. een schaal.<br />
 
<br />
 
Functie opbouw: <br />
 
setscale('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
setscale('welcomeimg',0.8);<br />
 
De waarde representeerd de schaal waarop het object / de afbeelding word omhoog geschaald in zowel de x als de y as.<br />
 
De waarde 1 is de originele waarde.<br />
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setid'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt het id van een al bestaande object / afbeelding.<br />
 
<br />
 
Functie opbouw: <br />
 
setid('object','waarde');<br />
 
<br />
 
Voorbeeld: <br />
 
setid('welcomeimg','goodbyeimg');<br />
 
Het object is het id van het object dat gewijzigd word, de waarde is het nieuwe id, het nieuwe id mag nog niet in gebruik zijn.<br />
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setlineheight'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt hoeveel verschil er tussen text regels zit.<br />
 
<br />
 
Functie opbouw: <br />
 
setlineheight('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
setlineheight('welcometext',10);<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''setrotation'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de rotatie van een object / afbeelding.<br />
 
<br />
 
Functie opbouw: <br />
 
setrotation('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
setrotation('welcomeimg',90);<br />
 
De waarde is de rotatie vanaf het originele rotatiepunt (0) in graden.<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''setx'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de positie van een object / afbeelding op de x-as. ( in pixels waarin links 0 is )<br />
 
<br />
 
Functie opbouw: <br />
 
setx('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
setx('welcomeimg',500);<br />
 
De afbeelding word nu 500 pixels vanaf de linkerkant verschoven naar rechts.<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''sety'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de positie van een object / afbeelding op de y-as. ( in pixels waarin bovenin 0 is )<br />
 
<br />
 
Functie opbouw: <br />
 
sety('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
sety('welcomeimg',200);<br />
 
De afbeelding word nu 200 pixels vanaf de bovenkant verschoven naar onderen toe.<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''setz'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt op welke laag een object / afbeelding zich bevind. ( waarin 0 achterin is )<br />
 
<br />
 
Functie opbouw: <br />
 
setz('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
setz('welcomeimg',10);<br />
 
De waarde is de laag waarop het object / de afbeelding geplaatst wordt, waarbij de laag 0 helemaal achterin is.<br />
 
Het object / de afbeelding die al actief is op de gekozen waarde wordt 1 plek omhoog geplaatst.<br />
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setstroke'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de 'stroke' (/omhulsel) van een object.<br />
 
<br />
 
Functie opbouw: <br />
 
setstroke('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
setstroke('newrect',20);<br />
 
Het object krijgt een omranding van de waarde in pixels.<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''setstrokecolor'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de kleur van de 'stroke' (/omhulsel) van een object.<br />
 
<br />
 
Functie opbouw: <br />
 
setstrokecolor('object','waarde');<br />
 
<br />
 
Voorbeeld: <br />
 
setstrokecolor('newrect','blue');<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''settextfont'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt het lettertype van een tekst object.<br />
 
<br />
 
Functie opbouw: <br />
 
settextfont('object','waarde');<br />
 
<br />
 
Voorbeeld: <br />
 
settextfont('welcometext','Arial');<br />
 
Het lettertype moet reeds bestaan, als dit niet het geval is behoud het de originele waarde. Let op: Hoofdletter gevoelig!<br />
 
Lettertypen kunnen direct gedownload worden of via url link gebruikt worden via: fonts.google.com<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''settextsize'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de grootte van een tekst object.<br />
 
<br />
 
Functie opbouw: <br />
 
settextsize('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
settextsize('welcometext',20);<br />
 
De waarde is het text formaat in pixels, waarbij 16 pixels de standaard is.<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''settextweight'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de 'dikte' van een tekst object. (Bold)<br />
 
<br />
 
Functie opbouw: <br />
 
settextweight('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
settextweight('welcometext',400);<br />
 
Mogelijke waarden: 'light', 'normal', 'bold', nummer.<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''setvisible'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de zichtbaarheid van een object / afbeelding of canvas.<br />
 
<br />
 
Functie opbouw: <br />
 
setvisible('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
setvisible('welcometext',0.7);<br />
 
Voor het zichtbaar of onzichtbaar maken van het canvas dient de waarde 1 of 0 te zijn, waarbij 0 onzichtbaar is en 1 zichtbaar.<br />
 
Voor het zichtbaar of onzichtbaar maken van objecten / afbeeldingen dient de waarde tussen de 0 en de 1 te liggen, waarbij 0 onzichtbaar is en 1 zichtbaar,
 
hierbij mogen decimalen gebruikt worden.<br />
 
 
 
<br /><br />
 
 
Functienaam:<br />
 
'''setflipx'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Draait het object / de afbeelding om. (Horizontaal)<br />
 
<br />
 
Functie opbouw: <br />
 
setflipx('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
setflipx('welcomeimg','true');<br />
 
De waarde 'true' draait het object / de afbeelding om van de originele waarde, de waarde 'false' zet het object / de afbeelding terug naar originele waarde.<br />
 
De waarde 'flip' zorgt er altijd voor dat het object / de afbeelding omdraait, ongeacht de staat / rotatie etc.<br />
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setflipy'''<br />
 
<br />
 
Functie beschrijving: <br />
 
draait het object / de afbeelding om . (Verticaal)<br />
 
<br />
 
Functie opbouw: <br />
 
setflipy('object',waarde);<br />
 
<br />
 
Voorbeeld: <br />
 
setflipy('welcomeimg','true');<br />
 
De waarde 'true' draait het object / de afbeelding om van de originele waarde, de waarde 'false' zet het object / de afbeelding terug naar originele waarde.<br />
 
De waarde 'flip' zorgt er altijd voor dat het object / de afbeelding omdraait, ongeacht de staat / rotatie etc.<br />
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''setdefault'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Wijzigt de standaard waarde waarmee objecten/afbeeldingen ingeladen worden.<br />
 
<br />
 
Functie opbouw: <br />
 
setdefault('object','property,propertyvalue');<br />
 
<br />
 
Voorbeeld: <br />
 
setdefault('text','fill,red';<br />
 
 
 
<br /><br />
 
 
 
===Retrieving object / imag properties===
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''getproperty'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Haalt de gekozen eigenschap (waarde) op van het object / de afbeelding.<br />
 
<br />
 
Functie opbouw: <br />
 
getproperty('object','value');<br />
 
<br />
 
Voorbeeld: <br />
 
getproperty('welcomeimg','top');<br />
 
De waarde is de eigenschap die u op wilt halen.<br />
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''getx'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Haalde de x-waarde op van het object.<br />
 
<br />
 
Functie opbouw: <br />
 
getx('object');<br />
 
<br />
 
Voorbeeld: <br />
 
getx('welcomeimg');<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''gety'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Haalde de y-waarde op van het object.<br />
 
<br />
 
Functie opbouw: <br />
 
gety('object');<br />
 
<br />
 
Voorbeeld: <br />
 
gety('welcomeimg');<br />
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''getz'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Haalde de laag op waarin het object zich bevind.<br />
 
<br />
 
Functie opbouw: <br />
 
getz('object');<br />
 
<br />
 
Voorbeeld: <br />
 
getz('welcomeimg');<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''getscale'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Haalt de schaal op van het object.<br />
 
<br />
 
Functie opbouw: <br />
 
getscale('object');<br />
 
<br />
 
Voorbeeld: <br />
 
getscale('welcomeimg');<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''getscalex'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Haalt de x-schaal op van het object.<br />
 
<br />
 
Functie opbouw: <br />
 
getscalex('object');x<br />
 
<br />
 
Voorbeeld: <br />
 
getscalex('welcomeimg');<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''getscaley'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Haalt de y-schaal op van het object.<br />
 
<br />
 
Functie opbouw: <br />
 
getscaley('object');<br />
 
<br />
 
Voorbeeld: <br />
 
getscaley('welcomeimg');<br />
 
 
 
<br /><br />
 
 
 
===Other functions===
 
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''copy'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Kopieert het gekozen object / afbeelding en geeft deze een nieuw id.<br />
 
<br />
 
Functie opbouw: <br />
 
copy('object','waarde');<br />
 
<br />
 
Voorbeeld: <br />
 
copy('welcomeimg','newimage');<br />
 
Het nieuwe id (waarde) moet uniek zijn.<br />
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''delete'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Verwijderd het gekozen object / afbeelding van het canvas.<br />
 
<br />
 
Functie opbouw: <br />
 
deletethis('object');<br />
 
<br />
 
Voorbeeld: <br />
 
deletethis('newimage');<br />
 
Bij deze functie dient enkel een object(id) meegegeven te worden.<br />
 
 
 
<br /><br />
 
 
Functienaam: <br />
 
'''clearcanvas'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Verwijderd alle objecten en afbeeldingen uit het gekozen canvas.<br />
 
<br />
 
Functie opbouw: <br />
 
clearcanvas('object');<br />
 
<br />
 
Voorbeeld: <br />
 
clearcanvas('c');<br />
 
Bij deze functie dient enkel een object(id) meegegeven te worden.<br />
 
Het object(id) is in dit geval dat van een canvas.<br />
 
 
<br /><br />
 
 
 
Functienaam: <br />
 
'''screenshot'''<br />
 
<br />
 
Functie beschrijving: <br />
 
Maakt een scherm afdruk van een canvas.<br />
 
<br />
 
Functie opbouw: <br />
 
screenshot('object');<br />
 
<br />
 
Voorbeeld: <br />
 
screenshot('c');<br />
 
Bij deze functie dient enkel een object(id) meegegeven te worden.<br />
 
Het object(id) is in dit geval dat van een 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]]

Latest revision as of 15:31, 3 December 2020

Naar de Nederlandse versie

Qmaze 2D product configurator user manual -- Engels / English


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

Individual function explanation


1. Getting started

Before getting started with creating the configurator you have to add some code to the outputscript.
This code does not only make sure that the canvas works like intented, but it also makes sure that it fits your wishes and requirements.
Below are a few examples (templates) of the code that you could use.


Templates

Template: The canvas uses the surrounding container for it's size.

<!-- 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>
 



Template: You choose the sizing yourself.

<!-- 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>
 



Template: You add a container yourself where you define the sizing. (Without bootstrap)

<!-- 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>
 


Template: You add a container yourself where you define the sizing. (With bootstrap)

<!-- 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>
 


Template: (OPTIONAL) Loader

<!-- 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>
 




2. Adding objects / images to the canvas.



Adding objects, images and text can easily be done with the help of a few functions.
You can use these functions in the rules and/or the outputscript.



2a. Filling the canvas using the rules.



Function structure:
x3d(id).function = value

Function structure complete:
x3d(object).functionname = value

In this example we will add an image and an text object to the canvas, which we are going to alter using different functions.

Do you have multiple canvasses? To add objects / images and text objects you must declare to which canvas these will be added beforehand, if you do not do this the latest added canvas will be used.

You can do that using this function:
x3d(id).setactivecanvas;

An example of this:
x3d(c).setactivecanvas;

  • Attention! We don't use ' ' and/or " " in the rules!*


Adding our first objects to the canvas

Adding a text object:
x3d(welcometext).settext = Hello World!

First of we will change the location of the text object, because this is placed in the top left by default.
We can achieve this using the setx and sety functions:

x3d(welcometext).setx = 100
x3d(welcometext).sety = 50

The image is now placed 100 pixels to the right and 50 pixels to the bottom (from the topleft)

Multiple functions work 2 ways around; they can not only add, but also alter objects.
When settext is run on an object that already exists but with a different value, the existent text is replaced with the new value.

x3d(welcometext).settext = How are you?

The text is replaced from 'Hello World!' to 'How are you?'.

Adding a image is not much different from adding a text object:

x3d(welcomeimg).setimage = /Images/pug.png

Changing the sizing (in this case of an image) can be done like this:

x3d(welcomeimg).setheight = 100
x3d(welcomeimg).setwidth= 100

The image is now 100 pixels in height and 100 pixels in width.

We can also change the sizing of the image using scale:

x3d(welcomeimg).setscale= 0.5

Do note that when you use the setheight and/or the setwidth function, the setscale function scales from the current sizing.

Through the setscale function we made the image 0.5x of its current size.

Besides the setx and sety functions theres also a function called setz.
This function changes the objects' layering:

x3d(welcomeimg).setz = 0

The given value in this example is 0, this is all the way in the back.
This means that all objects will be placed above this image.

The object that was on layer 0 is now placed into layer 1 and is therefore now above the image.

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.
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.
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.
Let's set the new width and height for every image.
You can do that like this:

x3d(image).setdefault = height,100
x3d(image).setdefault = height,100

Each image created after this function will now be 100 pixels in height and 100 pixels in width.
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.
As such:
x3d(image).setdefault = height,50
x3d(image).setdefault = height,50
The default width and height for images created after running this function are now 50 pixels in width and 50 pixels in height.
The setdefault function can save you alot of time if you wish to have alot of objects / images with the same properties.


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:Individual function explanation

2b. Filling the canvas using the outputscript.



Function structure:
x3d(id).function = value

Function structure complete:
x3d(object).functionname = value

In this example we will add an image and an text object to the canvas, which we are going to alter using different functions.

Do you have multiple canvasses? To add objects / images and text objects you must declare to which canvas these will be added beforehand, if you do not do this the latest added canvas will be used.

You can do that using this function:
setactivecanvas('id');

An example of this:
setactivecanvas('c');

Adding our first objects to the canvas

Adding a text object:
settext('welcometext','Hello World!');

First of we will change the location of the text object, because this is placed in the top left by default.
We can achieve this using the setx and sety functions:

setx('welcometext',100);
sety('welcometext',50);

The image is now placed 100 pixels to the right and 50 pixels to the bottom (from the topleft)

Multiple functions work 2 ways around; they can not only add, but also alter objects.
When settext is run on an object that already exists but with a different value, the existent text is replaced with the new value.

settext('welcometext','How are you?');

The text is replaced from 'Hello World!' to 'How are you?'.

Adding a image is not much different from adding a text object:

setimage('welcomeimg','/Images/pug.png');

Changing the sizing (in this case of an image) can be done like this:

setheight('welcomeimg',100);
setwidth('welcomeimg',100);

The image is now 100 pixels in height and 100 pixels in width.

We can also change the sizing of the image using scale:

setscale('welcomeimg',0.5);

Do note that when you use the setheight and/or the setwidth function, the setscale function scales from the current sizing.

Through the setscale function we made the image 0.5x of its current size.

Besides the setx and sety functions theres also a function called setz.
This function changes the objects' layering:

setz('welcomeimg',0);

The given value in this example is 0, this is all the way in the back.
This means that all objects will be placed above this image.

The object that was on layer 0 is now placed into layer 1 and is therefore now above the image.

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.
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.
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.
Let's set the new width and height for every image.
You can do that like this:

setdefault('image','height,100');
setdefault('image','width,100');

Each image created after this function will now be 100 pixels in height and 100 pixels in width.
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.
As such:
setdefault('image','height,50');
setdefault('image','width,50');
The default width and height for images created after running this function are now 50 pixels in width and 50 pixels in height.
The setdefault function can save you alot of time if you wish to have alot of objects / images with the same properties.


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:Individual function explanation