Become the Creator God
PixelsWorld documentation version: v3.7.0
Author ZzStarSound
History
v2.3.1
v1.0
中文版
日本語
Welcome to PixelsWorld!
In this section, we've distilled the essence of using PixelsWorld. If you comprehend this part, you'll become a new creator in PixelsWorld!
Simply Put
PixelsWorld renders graphics based on your code
Here are some key points you must know:
- PixelsWorld functions like a simple game engine.
- All the code you provide runs within a Lua engine.
- Writing code in PixelsWorld is like crafting a powerful expression. PixelsWorld supports:
- PixelsWorld can render simple 2D/3D geometries. Details >>>
Video Tutorials
We highly recommend starting with our foundational tutorials.
Lua Example: Drawing a House
Here, we provide a code example for drawing a house in Lua mode.
DrawHouse1.lua
version3() -- Use version 3, always call this function on the first line.
move(width/2, height/2) -- Move the brush to the center of the screen
rotateX(PI) -- Rotate the brush coordinates 180 degrees around the X-axis
fill(1,1,0) -- Use yellow paint (red=1, green=1, blue=0)
rect(100) -- Draw a 100x100 pixel square
fill(1,0,0) -- Use red paint (red=1, green=0, blue=0)
move(0,50) -- Move the brush coordinates up 50 pixels
tri(150,100) -- Draw an isosceles triangle with a base of 150 pixels and height of 100 pixels
Here, we aim to add some extra controls to the scene, like a color combination controller for the house.
DrawHouse2.lua
version3() -- Use version 3, always call this function on the first line.
move(width/2, height/2) -- Move the brush coordinates to the center
rotateX(PI) -- Rotate the brush coordinates 180 degrees around the X-axis
fill(color(0)) -- Use color #0
rect(100) -- Draw a 100x100 pixel square
fill(color(1)) -- Use color #1
move(0,50) -- Move the brush coordinates up 50 pixels
tri(150,100) -- Draw an isosceles triangle with a base of 150 pixels and height of 100 pixels
Then click confirm, and the house will... disappear!
In fact, our house is still being rendered on the layer, but as the default colors of the color controller are black, the house seems to disappear.
To resolve this, open the parameter list, find the first two color controllers, and change them to your preferred colors.
I'm the Mayor! Draw More Houses
The great advantage of code is handling repetitive operations.
Needless to say, the Lua language allows you to write loop code.
DrawHouse3.lua
version3() -- Use version 3, always call this function on the first line.
move(width/2, height/2) -- Move the brush coordinates to the center
rotateX(PI) -- Rotate the brush coordinates 180 degrees around the X-axis
for i=1,3 do -- Start repeating (3 times)
fill(color(0)) -- Use color #0
rect(100) -- Draw a 100x100 pixel square
fill(color(1)) -- Use color #1
move(0,50) -- Move the brush coordinates up 50 pixels
tri(150,100) -- Draw an isosceles triangle with a base of 150 pixels and height of 100 pixels
move(0,-50) -- Move the brush coordinates back
move(175,0) -- Move the brush coordinates 175 pixels to the right
end -- End repeating
The above code includes the operation of "moving the brush coordinates back," which can be cumbersome each time. Use beginGroup()
and endGroup()
to simplify:
DrawHouse4.lua
version3() -- Use version 3, always call this function on the first line.
move(width/2, height/2) -- Move the brush coordinates to the center
rotateX(PI) -- Rotate the brush coordinates 180 degrees around the X-axis
for i=1,3 do -- Start loop (3 times)
fill(color(0)) -- Use color #0
rect(100) -- Draw a 100x100 pixel square
fill(color(1)) -- Use color #1
beginGroup() -- New line! Start recording brush coordinate transformations
move(0,50) -- Move the brush coordinates up 50 pixels
tri(150,100) -- Draw an isosceles triangle with a base of 150 pixels and height of 100 pixels
endGroup() -- New line! This line will automatically call 'move(0,-50)'
move(175,0) -- Move the brush coordinates 175 pixels to the right
end -- End loop
Finally, we want to name the controllers:
Saving Code as Presets
Note: If you installed Ae on the system disk (e.g.,
C:\
), this step requires admin mode.
First, create your own preset category:
Then save your preset under your own preset category:
Applying Presets
Select the preset you want, and click the Replace button on the right.
Congratulations!
You've mastered the general usage process of PixelsWorld!
>>>Next Step (Beginner): Enter the Lua chapter to understand the core capabilities of PixelsWorld
>>>Next Step (Intermediate): Learn how to call the GPU to help you render and process images
PixelsWorld Structure
PixelsWorld Capabilities