//-------------------------------------------------------------- ofxJSBOOL Animation::jsNewSlider(ofxJSContext* cx, ofxJSObject* obj, uintN argc, ofxJSValue* argv, ofxJSValue* retVal) { Animation* pThis = sm_mapJSObj_Anim[obj]; // printf(">>> obj=%p, pThis=%p, from the map %p\n", obj, pThis, sm_mapJSObj_Anim[obj]); if (pThis && pThis->mp_UIcanvas) { if (argc == 4) { string name = ofxJSValue_TO_string(argv[0]); float min = ofxJSValue_TO_float(argv[1]); float max = ofxJSValue_TO_float(argv[2]); float val = ofxJSValue_TO_float(argv[3]); // TODO : may be move this somewhere else ? classProperty_float* pProp = new classProperty_float(name,min,max); pThis->m_properties.add( pProp ); pThis->mp_UIcanvas->addWidgetDown( new ofxUISlider(name, min,max,pProp->mp_variable, ANIM_UI_WIDTH_DEFAULT,ANIM_UI_HEIGHT_DEFAULT) ); return JS_TRUE; } } return JS_FALSE; }
//-------------------------------------------------------------- void Timeline::M_getPropertiesJS() { // Javascript properties ofxJSValue retVal; ofxJSValue args[1]; args[0] = string_TO_ofxJSValue(string("d")); ofxJSCallFunctionNameGlobal("getTimelineCycle", args, 1, retVal); m_cycleDuration = ofxJSValue_TO_float(retVal); args[0] = string_TO_ofxJSValue(string("dScene")); ofxJSCallFunctionNameGlobal("getTimelineCycle", args, 1, retVal); m_cycleDurationScene = ofxJSValue_TO_float(retVal); args[0] = string_TO_ofxJSValue(string("dEcoute")); ofxJSCallFunctionNameGlobal("getTimelineCycle", args, 1, retVal); m_cycleDurationEcoute = ofxJSValue_TO_float(retVal); args[0] = string_TO_ofxJSValue(string("dCompteur")); ofxJSCallFunctionNameGlobal("getTimelineCycle", args, 1, retVal); m_cycleDurationCompteur = ofxJSValue_TO_float(retVal); args[0] = string_TO_ofxJSValue(string("dContemplation")); ofxJSCallFunctionNameGlobal("getTimelineCycle", args, 1, retVal); m_cycleDurationContemplation = ofxJSValue_TO_float(retVal); }