forked from icosa-foundation/open-brush
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI BUILD]
- Loading branch information
Showing
6 changed files
with
135 additions
and
1 deletion.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
Assets/Resources/LuaScriptExamples/SymmetryScript.Ellipse.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
Settings = { | ||
description="Radial copies of your stroke with optional color shifts" | ||
} | ||
|
||
Parameters = { | ||
copies={label="Number of copies", type="int", min=1, max=36, default=32}, | ||
eccentricity={label="Eccentricity", type="float", min=0.1, max=3, default=2}, | ||
axisConsistency={label="Axis Consistency", type="float", min=0, max=2, default=1}, | ||
hueShiftFrequency={label="Hue Shift Frequency", type="float", min=0.1, max=6, default=1}, | ||
hueShiftAmount={label="Hue Shift Amount", type="float", min=0, max=1, default=0.3} | ||
} | ||
|
||
function Start() | ||
initialHsv = brush.colorHsv | ||
--symmetry.transform = { | ||
-- {0, 10, 6}, | ||
-- {0, 90, 90} | ||
--} | ||
end | ||
|
||
function Main() | ||
|
||
pointers = {} | ||
theta = (math.pi * 2.0) / copies | ||
Colors = {} | ||
|
||
for i = 0, copies - 1 do | ||
angle = (symmetry.rotation.y * unityMathf.deg2Rad) + i * theta | ||
pointer = { | ||
position={ | ||
symmetry.brushOffset.x * symmetry.ellipse(angle, eccentricity), | ||
symmetry.brushOffset.y, | ||
unityMathf.lerp( | ||
symmetry.brushOffset.z, | ||
symmetry.brushOffset.z * symmetry.ellipse(angle, eccentricity), | ||
axisConsistency | ||
), | ||
}, | ||
rotation={0, angle * unityMathf.rad2Deg, 0} | ||
} | ||
table.insert(pointers, pointer) | ||
|
||
--Colour cycling for the extra pointers | ||
if hueShiftAmount > 0 then | ||
t = i / copies | ||
newHue = waveform.triangle(t, hueShiftFrequency) * hueShiftAmount | ||
newColor = unityColor.hsvToRgb(initialHsv.x + newHue, initialHsv.y, initialHsv.z) | ||
table.insert(Colors, newColor) | ||
end | ||
|
||
end | ||
return pointers | ||
end | ||
|
||
function End() | ||
--TODO | ||
--color.setHsv(color.HsvToRgb(brush.colorHsv)) | ||
end |
10 changes: 10 additions & 0 deletions
10
Assets/Resources/LuaScriptExamples/SymmetryScript.Ellipse.lua.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
Assets/Resources/LuaScriptExamples/SymmetryScript.TooManyAround.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
Settings = { | ||
description="Radial copies of your stroke with optional color shifts" | ||
} | ||
|
||
Parameters = { | ||
copies={label="Number of copies", type="int", min=1, max=36, default=32}, | ||
hueShiftFrequency={label="Hue Shift Frequency", type="float", min=0.1, max=6, default=1}, | ||
hueShiftAmount={label="Hue Shift Amount", type="float", min=0, max=1, default=0.3} | ||
} | ||
|
||
function Start() | ||
initialHsv = brush.colorHsv | ||
--symmetry.transform = { | ||
-- {0, 10, 6}, | ||
-- {0, 90, 90} | ||
--} | ||
end | ||
|
||
function Main() | ||
|
||
pointers = {} | ||
theta = 360.0 / copies | ||
Colors = {} | ||
|
||
for i = 0, copies - 1 do | ||
angle = i * theta | ||
pointer = { | ||
position={ | ||
symmetry.brushOffset.x * (1 + (math.sin(angle/360 * 16 * math.pi)) * 0.25), | ||
symmetry.brushOffset.y, | ||
symmetry.brushOffset.z | ||
}, | ||
rotation={0, angle, 0} | ||
} | ||
table.insert(pointers, pointer) | ||
|
||
--Colour cycling for the extra pointers | ||
if hueShiftAmount > 0 then | ||
t = i / copies | ||
newHue = waveform.triangle(t, hueShiftFrequency) * hueShiftAmount | ||
newColor = unityColor.hsvToRgb(initialHsv.x + newHue, initialHsv.y, initialHsv.z) | ||
table.insert(Colors, newColor) | ||
end | ||
|
||
end | ||
return pointers | ||
end | ||
|
||
function End() | ||
--TODO | ||
--color.setHsv(color.HsvToRgb(brush.colorHsv)) | ||
end |
10 changes: 10 additions & 0 deletions
10
Assets/Resources/LuaScriptExamples/SymmetryScript.TooManyAround.lua.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters