Frequency is more intuitive and allows to achieve steady strobe (no movement) setting it to zero.
Using ratio it would need to set it to infinite to obtain a steady strobe.
Layer_Stroboscope::Layer_Stroboscope()
{
Layer_Stroboscope::Layer_Stroboscope()
{
}
Layer_Stroboscope::~Layer_Stroboscope()
}
Layer_Stroboscope::~Layer_Stroboscope()
bool
Layer_Stroboscope::set_param(const String & param, const ValueBase &value)
{
bool
Layer_Stroboscope::set_param(const String & param, const ValueBase &value)
{
return Layer::set_param(param,value);
}
return Layer::set_param(param,value);
}
ValueBase
Layer_Stroboscope::get_param(const String & param)const
{
ValueBase
Layer_Stroboscope::get_param(const String & param)const
{
EXPORT_NAME();
EXPORT_VERSION();
EXPORT_NAME();
EXPORT_VERSION();
{
Layer::Vocab ret(Layer::get_param_vocab());
{
Layer::Vocab ret(Layer::get_param_vocab());
- ret.push_back(ParamDesc("ratio")
- .set_local_name(_("Ratio"))
+ ret.push_back(ParamDesc("frequency")
+ .set_local_name(_("Frequency"))
+ .set_description(_("Frequency of the Strobe in times per second"))
void
Layer_Stroboscope::set_time(Context context, Time t)const
{
void
Layer_Stroboscope::set_time(Context context, Time t)const
{
- if (ratio != 0)
- {
- float fps = 24.0;
- Canvas::LooseHandle canvas(get_canvas());
- if(canvas)
- fps = canvas->rend_desc().get_frame_rate(); //not works :(
- float frame = floor((t*fps)/ratio)*ratio;
- t = Time(1)*(frame/fps);
- }
-
- context.set_time(t);
+ Time ret_time=Time::begin();
+ if(frequency > 0.0)
+ ret_time = Time(1.0)/frequency*floor(t*frequency);
+
+ context.set_time(ret_time);
SYNFIG_LAYER_MODULE_EXT
private:
SYNFIG_LAYER_MODULE_EXT
private:
protected:
Layer_Stroboscope();
protected:
Layer_Stroboscope();