Skip to content
Snippets Groups Projects
Commit 7db54ea3 authored by Jake Read's avatar Jake Read
Browse files

at filter video

parent 06df6928
Branches
No related tags found
No related merge requests found
/*
rolling filter,
*/
import { Hunkify, Input, Output, State } from '../hunks.js'
export default function Smooth(){
Hunkify(this)
let inNum = this.input('number', 'vals')
let outNum = this.output('number', 'smoother')
let reset = this.state('boolean', 'reset', false)
let weight = this.state('number', 'weight, 0-1', 0.9)
let yl = 0
reset.onChange = (value) => {
yl = 0
}
weight.onChange = (value) => {
weight.set(Math.max(Math.min(value, 1), 0))
}
this.loop = () => {
if(inNum.io() && !outNum.io()){
yl = weight.value * inNum.get() + (1 - weight.value) * yl
outNum.put(yl)
}
}
}
......@@ -14,8 +14,8 @@ import {
function Counter() {
Hunkify(this)
let evtInc = new Input('any', 'increment', this)
let evtDec = new Input('any', 'decrement', this)
let evtInc = new Input('number', 'increment', this)
let evtDec = new Input('number', 'decrement', this)
let resetInp = new Input('boolean', 'reset', this)
this.inputs.push(evtInc, evtDec, resetInp)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment