hayasidist wrote: ↑Sun Jul 24, 2022 6:43 pm
ggoblin wrote: ↑Thu Jul 21, 2022 8:21 am
fNoiseAmp and fNoiseInterval ... are in pixels in UI .... (This should be documented in the API guide - it actually has no documentation on these fields other than their name and type)
Updates to mohoscripting done.
and
Found this
http://lostmarble.com/forum/viewtopic.php?p=137698 from nearly a decade ago! Might be useful!
Ah, I forgot about that thread.
I'll share the scripts we ended up creating and using for a Dutch TV-Show called
Buitenspelen / Outside, here's a link to an epsisode about:
penguins and gnomes
No idea if these still work in the latest Moho, but maybe they're useful to you as a starting point. I haven't checked them out or tested them. If I recall correctly, the first one turns on a jiggle vector effect for all(?) layers, the second one too but with more extreme values, the third one turned it off (we needed it to be turned off while animating).
We called it the Schaaik-effect because that was the directors name and he established the style before we got on board. It was a fun project.
Code: Select all
-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************
ScriptName = "LK_Schaaikeffect"
-- **************************************************
-- General information about this script
-- **************************************************
LK_Schaaikeffect = {}
function LK_Schaaikeffect:Name()
return "Het Schaaik effect standaard"
end
function LK_Schaaikeffect:Version()
return "0.1"
end
function LK_Schaaikeffect:Description()
return ("Schaaik-effect standaard")
end
function LK_Schaaikeffect:Creator()
return "Lukas"
end
function LK_Schaaikeffect:UILabel()
return("Schaaik-effect standaard")
end
-- **************************************************
-- The guts of this script
-- **************************************************
function LK_Schaaikeffect:Run(moho)
moho.document:PrepMultiUndo()
moho.document:SetDirty()
for j = 0, moho.document:CountLayers()-1 do
local layer = moho.document:Layer(j)
self:ConvertLayer(moho, layer)
end
LM.GUI.Alert(LM.GUI.ALERT_INFO, "Alle lagen zijn klaar om buiten te spelen!")
end
function LK_Schaaikeffect:ConvertLayer(moho, layer)
if (layer:LayerType() == MOHO.LT_VECTOR) then
local vectorLayer = moho:LayerAsVector(layer)
vectorLayer.fNoisyLines = true
vectorLayer.fNoisyShapes = true
vectorLayer.fAnimatedNoise = true
vectorLayer.fExtraSketchy = false
vectorLayer.fExtraLines = 0
vectorLayer.fNoiseAmp = 6.0 / moho.document:Height()
vectorLayer.fNoiseScale = 48.0 / moho.document:Height()
local mesh = vectorLayer:Mesh()
for k = 0, mesh:CountShapes() -1 do
local shape = mesh:Shape(k)
shape:MakePlain()
local brush = LM.String:new_local("Brush001.png")
shape.fMyStyle:SetSoftEdge(18.0 / moho.document:Height())
shape.fMyStyle.fBrushName = brush
end
elseif layer:IsGroupType() then
local groupLayer = moho:LayerAsGroup(layer)
for i = 0, groupLayer:CountLayers()-1 do
local subLayer = groupLayer:Layer(i)
self:ConvertLayer(moho, subLayer)
end
end
end
Code: Select all
-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************
ScriptName = "LK_Schaaikeffect_More"
-- **************************************************
-- General information about this script
-- **************************************************
LK_Schaaikeffect_More = {}
LK_Schaaikeffect_More.BASE_STR = 2480
function LK_Schaaikeffect_More:Name()
return "Het Schaaik effect"
end
function LK_Schaaikeffect_More:Version()
return "0.1"
end
function LK_Schaaikeffect_More:Description()
return ("Schaaik-effect plus")
end
function LK_Schaaikeffect_More:Creator()
return "Lukas"
end
function LK_Schaaikeffect_More:UILabel()
return("Schaaik-effect plus")
end
-- **************************************************
-- The guts of this script
-- **************************************************
function LK_Schaaikeffect_More:Run(moho)
moho.document:PrepMultiUndo()
moho.document:SetDirty()
for j = 0, moho.document:CountLayers()-1 do
local layer = moho.document:Layer(j)
self:ConvertLayer(moho, layer)
end
LM.GUI.Alert(LM.GUI.ALERT_INFO, "Alle lagen zijn klaar om buiten te spelen!")
end
function LK_Schaaikeffect_More:ConvertLayer(moho, layer)
if (layer:LayerType() == MOHO.LT_VECTOR) then
local vectorLayer = moho:LayerAsVector(layer)
vectorLayer.fNoisyLines = true
vectorLayer.fNoisyShapes = true
vectorLayer.fAnimatedNoise = true
vectorLayer.fExtraSketchy = false
vectorLayer.fExtraLines = 0
vectorLayer.fNoiseAmp = 12.0 / moho.document:Height()
vectorLayer.fNoiseScale = 70.0 / moho.document:Height()
local mesh = vectorLayer:Mesh()
for k = 0, mesh:CountShapes() -1 do
local shape = mesh:Shape(k)
shape:MakePlain()
local brush = LM.String:new_local("Brush001.png")
shape.fMyStyle:SetSoftEdge(18.0 / moho.document:Height())
shape.fMyStyle.fBrushName = brush
end
elseif layer:IsGroupType() then
local groupLayer = moho:LayerAsGroup(layer)
for i = 0, groupLayer:CountLayers()-1 do
local subLayer = groupLayer:Layer(i)
self:ConvertLayer(moho, subLayer)
end
end
end
Code: Select all
-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************
ScriptName = "LK_Schaaikeffect_Off"
-- **************************************************
-- General information about this script
-- **************************************************
LK_Schaaikeffect_Off = {}
LK_Schaaikeffect_Off.BASE_STR = 2480
function LK_Schaaikeffect_Off:Name()
return "Het Schaaik effect"
end
function LK_Schaaikeffect_Off:Version()
return "0.1"
end
function LK_Schaaikeffect_Off:Description()
return ("Zet Schaaik-effect uit")
end
function LK_Schaaikeffect_Off:Creator()
return "Lukas"
end
function LK_Schaaikeffect_Off:UILabel()
return ("Zet het Schaaikeffect uit")
end
-- **************************************************
-- The guts of this script
-- **************************************************
function LK_Schaaikeffect_Off:Run(moho)
moho.document:PrepMultiUndo()
moho.document:SetDirty()
for j = 0, moho.document:CountLayers()-1 do
local layer = moho.document:Layer(j)
self:ConvertLayer(moho, layer)
end
LM.GUI.Alert(LM.GUI.ALERT_INFO, "Alle lagen zijn weer binnen televisie aan het kijken als een stel zombies!")
end
function LK_Schaaikeffect_Off:ConvertLayer(moho, layer)
if (layer:LayerType() == MOHO.LT_VECTOR) then
local vectorLayer = moho:LayerAsVector(layer)
vectorLayer.fNoisyLines = false
vectorLayer.fNoisyShapes = false
vectorLayer.fAnimatedNoise = false
vectorLayer.fExtraSketchy = false
vectorLayer.fExtraLines = 0
vectorLayer.fNoiseAmp = 0 / moho.document:Height()
vectorLayer.fNoiseScale = 0 / moho.document:Height()
--[[
local mesh = vectorLayer:Mesh()
for k = 0, mesh:CountShapes() -1 do
local shape = mesh:Shape(k)
shape:MakePlain()
end
]]
elseif layer:IsGroupType() then
local groupLayer = moho:LayerAsGroup(layer)
for i = 0, groupLayer:CountLayers()-1 do
local subLayer = groupLayer:Layer(i)
self:ConvertLayer(moho, subLayer)
end
end
end