void GUIAlphaElement::modifyCurrentAlpha(float clockTick) { if(!mouseOver && !pressed) setAlpha(color.w - clockTick * alphaFadeScale); else setAlpha(color.w + clockTick * alphaFadeScale); }
void Color::applySettings(ResourceDescriptor settings) { std::vector<std::string> values = split(settings.getValue(), ','); if (values.size() == 3 || values.size() == 4) { setRed(std::stoi(values[0])); setGreen(std::stoi(values[1])); setBlue(std::stoi(values[2])); } if (values.size() == 4) { setAlpha(std::stoi(values[2])); } ResourceDescriptor sub = settings.getSubResource("Red"); if (isNotEmpty(sub.getValue())) { setRed(std::stoi(sub.getValue())); } sub = settings.getSubResource("Green"); if (isNotEmpty(sub.getValue())) { setGreen(std::stoi(sub.getValue())); } sub = settings.getSubResource("Blue"); if (isNotEmpty(sub.getValue())) { setBlue(std::stoi(sub.getValue())); } sub = settings.getSubResource("Alpha"); if (isNotEmpty(sub.getValue())) { setAlpha(std::stoi(sub.getValue())); } }
void GuiPiano::setActive (bool value) { setInterceptsMouseClicks(false, value); if (value == true) { setAlpha(1.0f); //don't think I need to set label text here as it will be set somewhere else. } else { setAlpha(0.3f); midiNoteLabel->setText(String::empty, dontSendNotification); for (int i = 0; i < 120; i++) setKeyDisplay(i, false); } /* else if (value == true) { updateDisplay(); } */ }
void MoonWalker::render(VoodooGraphics graphics, int elapsed) { graphics.painter()->save(); // если нужно создать наклон для машинки if(position()->x() >= 0 && position()->x() <= 30) { setAlpha(1); } else if (position()->x() >= 30 && position()->x() <= 50) { setAlpha(2); } else if (position()->x() >= 100 && position()->x() <= 300) { setAlpha(-1); } else if (position()->x() >= 300 && position()->x() <= 510) { setAlpha(1); } else if (position()->x() >= 510 && position()->x() <= 800) { setAlpha(-4); } // тело машины drawLines(graphics, lines1); // кабинка drawLines(graphics, lines2); // антенна drawLines(graphics, lines3); QPoint point; qint32 radius = 1 * scale(); for(int i = 0; i < 4; i++) { point = graphics.rotate(10 * scale() - i * radius * 2, 7 * scale(), alpha()); graphics.drawCircle(point.x() + position()->x(), point.y() + position()->y(), radius); graphics.drawCircle(point.x() + position()->x(), point.y() + position()->y(), elapsed / 160); } // антенна point = graphics.rotate(12 * scale(), 0, alpha()); graphics.drawCircle(position()->x() + point.x(), position()->y() + point.y(), 1 * scale()); graphics.drawCircle(position()->x() + point.x(), position()->y() + point.y(), 5); graphics.drawCircle(position()->x() + point.x(), position()->y() + point.y(), elapsed / 20); if (position()->x() >= width() + 10) { setPosition(0, position()->y()); setIterator(0); } setPosition(iterator() + 1, position()->y()); setIterator(iterator() + 1); graphics.painter()->restore(); }
LevenshteinDistance::LevenshteinDistance(double alpha) { if (alpha == -1) { setAlpha(ConfigOptions().getLevenshteinDistanceAlpha()); } else { setAlpha(alpha); } }
/************************************************************************* Tells the popup menu to open. *************************************************************************/ void PopupMenu::openPopupMenu(bool notify) { // already open and not fading, or fading in? if (d_isOpen && (!d_fading || !d_fadingOut)) { // then don't do anything return; } // should we let the parent menu item initiate the open? Window* parent = getParent(); if (notify && parent && parent->testClassName("MenuItem")) { static_cast<MenuItem*>(parent)->openPopupMenu(); return; // the rest will be handled when MenuItem calls us itself } // we'll handle it ourselves then. // are we fading, and fading out? if (d_fading && d_fadingOut) { if (d_fadeInTime>0.0f&&d_fadeOutTime>0.0f) { // jump to the point of the fade in that has the same alpha as right now - this keeps it smooth d_fadeElapsed = ((d_fadeOutTime-d_fadeElapsed)/d_fadeOutTime)*d_fadeInTime; } else { // start the fade in from the beginning d_fadeElapsed = 0; } // change to fade in d_fadingOut=false; } // otherwise just start normal fade in! else if (d_fadeInTime>0.0f) { d_fading = true; d_fadingOut=false; setAlpha(0.0f); d_fadeElapsed = 0; } // should not fade! else { d_fading = false; setAlpha(d_origAlpha); } show(); moveToFront(); }
void Window::setAutoAlpha(bool _auto) { mIsAutoAlpha = _auto; if (!_auto) setAlpha(ALPHA_MAX); else { if (mKeyRootFocus) setAlpha(WINDOW_ALPHA_ACTIVE); else if (mMouseRootFocus) setAlpha(WINDOW_ALPHA_FOCUS); else setAlpha(WINDOW_ALPHA_DEACTIVE); } }
FrechetDistribution::FrechetDistribution(double alpha, double beta) : UncertaintyDescription(boost::shared_ptr<detail::UncertaintyDescription_Impl>( new detail::UncertaintyDescription_Impl(FrechetDistribution::type()))) { setAlpha(alpha); setBeta(beta); }
/*! Constructor. Call init() to initialise the Hinkley's test and set \f$\alpha\f$ and \f$\delta\f$ to default values. By default \f$ \delta = 0.2 \f$ and \f$ \alpha = 0.2\f$. Use setDelta() and setAlpha() to modify these values. */ vpHinkley::vpHinkley() { init(); setAlpha(0.2); setDelta(0.2); }
void Txtr::load(const fschar *colorsFileName, const fschar *alphaFileName) { removeImage(); if (colorsFileName) loadColors(colorsFileName); if (alphaFileName && hasImage()) loadAlpha(alphaFileName, 255); else setAlpha(255); }
bool Rgb::setSlotAlpha(Number* const msg) { LCreal value = msg->getReal(); bool ok = setAlpha( value ); if (!ok) std::cerr << "Rgb::setAlpha: invalid entry(" << value << "), valid range: 0 to 1" << std::endl; return ok; }
void NumberAnimation::setParametr(const std::string & _param, double _value) { m_currentParam = _param; if (_param == "scale") { m_params[_param] = _value; setScale(); } else if (_param == "angle") { m_params[_param] = _value; setAngle(); } else if (_param == "alpha") { m_params[_param] = _value; setAlpha(); } else if (_param == "width") { m_params[_param] = _value; setWidth(); } else if (_param == "height") { m_params[_param] = _value; setHeight(); } else { m_currentParam = ""; } }
void CVX_Material::setColor(int red, int green, int blue, int alpha) { setRed(red); setGreen(green); setBlue(blue); setAlpha(alpha); }
void Color::set( float r, float g, float b, float a ) { setRed( r ); setGreen( g ); setBlue( b ); setAlpha( a ); }
void Drawable::nonConstDraw (Graphics& g, float opacity, const AffineTransform& transform) { Graphics::ScopedSaveState ss (g); const float oldOpacity = getAlpha(); setAlpha (opacity); g.addTransform (AffineTransform::translation ((float) -originRelativeToComponent.getX(), (float) -originRelativeToComponent.getY()) .followedBy (getTransform()) .followedBy (transform)); if (! g.isClipEmpty()) paintEntireComponent (g, false); setAlpha (oldOpacity); }
vpHinkley::vpHinkley(double alpha, double delta) { init(); setAlpha(alpha); setDelta(delta); }
void Window::setVisibleSmooth(bool _visible) { mAnimateSmooth = true; ControllerManager::getInstance().removeItem(this); if (_visible) { setEnabledSilent(true); if (!getVisible()) { setAlpha(ALPHA_MIN); Base::setVisible(true); } ControllerFadeAlpha* controller = createControllerFadeAlpha(getAlphaVisible(), WINDOW_SPEED_COEF, true); controller->eventPostAction += newDelegate(this, &Window::animateStop); ControllerManager::getInstance().addItem(this, controller); } else { setEnabledSilent(false); ControllerFadeAlpha* controller = createControllerFadeAlpha(ALPHA_MIN, WINDOW_SPEED_COEF, false); controller->eventPostAction += newDelegate(action::actionWidgetHide); ControllerManager::getInstance().addItem(this, controller); } }
/* Process command line parameters: argv[1]: Name of data file or '-' for stdin argv[2]: Number of changepoints argv[3]: Number of iterations argv[4]: seed for random number generator argv[5]: (optional) Prefix for output files */ void getFixedArgs(int argc, char **argv) { char* endptr; const char* usage="icmcstatFixed FILE NK ITERATIONS SEED [OUTPUTPREFIX]"; double alpha=1, beta=1; if(argc<5) fprintf(ERR, "%s\n", usage), exit(1); dataFn=argv[1]; printf("Reading data from "); if(!strcmp(dataFn, "-")) printf("stdin\n"); else printf("%s\n", dataFn); printf("%s nK\n", argv[2]); nK = strtol(argv[2], &endptr, 10); nProb=nK+1; printf("%s iterations\n", argv[3]); nIter = strtol(argv[3], &endptr, 10); seed = strtol(argv[4], &endptr, 10); printf("Seed for random number generator: %i\n", seed); /* Optional parameter*/ if(argc==6) { prefix=argv[5]; printf("Prefix prepended to output files: %s\n", prefix); } fprintf(ERR, "Setting alpha=%g, beta=%g\n", alpha, beta); setAlpha(alpha); setBeta(beta); }
//------------------------------------------------------------ //------------------------------------------------------------ bool Pareto::setSlotAlpha(const Number* const x) { bool ok = false; if(x != 0) ok = setAlpha(x->getDouble()); return ok; }
// Called every frame void SpriteActorView::update(float dt) { ActorView::update(dt); // If sprite needs to fade, fade according to passed time from last frame if (_fadeDuration > 0) { float fadeDelta = _targetAlpha - _alpha; float timeDelta = _fadeDuration / dt; setAlpha(_alpha + (fadeDelta / timeDelta)); _fadeDuration -= dt; } // Check if we need to move if (!_isMoving && !_movementQueue.empty()) { // std::cout << "SpriteActorView::update - Popping movement " << _movementQueue.front().animationName << std::endl; Movement movement = _movementQueue.front(); _currentMovement = &movement; // Start animation playAnimation(movement.animationName); // Move moveTo(movement.target, movement.duration); _movementQueue.pop_front(); } else if (!_isMoving && _movementQueue.empty() && _currentMovement != NULL) { // Just finished queue,publish event _currentMovement = NULL; EventManager::getInstance()->publish("MOVEMENT_QUEUE_ENDED", _agent); } }
void OffScreenExplode::setActive() { active = true; setAlpha(0); changeAnimation("normal", FORWARD); Console::WriteLine("setting OffScreenExplode Active"); }
void Overlay::setProperties(const QScriptValue& properties) { QScriptValue color = properties.property("color"); if (color.isValid()) { QScriptValue red = color.property("red"); QScriptValue green = color.property("green"); QScriptValue blue = color.property("blue"); if (red.isValid() && green.isValid() && blue.isValid()) { _color.red = red.toVariant().toInt(); _color.green = green.toVariant().toInt(); _color.blue = blue.toVariant().toInt(); } } if (properties.property("alpha").isValid()) { setAlpha(properties.property("alpha").toVariant().toFloat()); } if (properties.property("visible").isValid()) { setVisible(properties.property("visible").toVariant().toBool()); } if (properties.property("anchor").isValid()) { QString property = properties.property("anchor").toVariant().toString(); if (property == "MyAvatar") { setAnchor(MY_AVATAR); } } }
void Color::set( Color c ) { setRed( c.getRed() ); setGreen( c.getGreen() ); setBlue( c.getBlue() ); setAlpha( c.getAlpha() ); }
void Color::setColor(float red, float green, float blue, float alpha) { setRed(red); setGreen(green); setBlue(blue); setAlpha(alpha); }
void DebugActor::onDAEvent(Event* ev) { TouchEvent* t = safeCast<TouchEvent*>(ev); Vector2 loc = parent2local(t->localPosition); if (t->type == TouchEvent::MOVE) { setAlpha(isOn(loc) ? 64 : 255); if (_dragging) { Transform tr = getTransform(); tr.x = 0; tr.y = 0; Vector2 p = tr.transform(_local); setPosition(t->localPosition - p); } } if (t->type == TouchEvent::TOUCH_DOWN) { if (isOn(loc)) { _local = loc; _dragging = true; } } if (t->type == TouchEvent::TOUCH_UP) { _dragging = false; } }
GumbelDistribution::GumbelDistribution(double alpha, double beta) : UncertaintyDescription(std::shared_ptr<detail::UncertaintyDescription_Impl>( new detail::UncertaintyDescription_Impl(GumbelDistribution::type()))) { setAlpha(alpha); setBeta(beta); }
void Color::setColor(Color color) { setRed(color.getRed()); setGreen(color.getGreen()); setBlue(color.getBlue()); setAlpha(color.getAlpha()); }
void Flag::initParticleSystem(irr::scene::ISceneManager* a_SceneManager) { //Create Particle System irr::scene::IParticleSystemSceneNode* particleSystem = a_SceneManager->addParticleSystemSceneNode(false); auto colDark = getColor(); auto colBright = colDark; colBright.setAlpha(0); //Emitter irr::scene::IParticleEmitter* particleEmitter = particleSystem->createBoxEmitter( irr::core::aabbox3d<irr::f32>(-7, 0, -7, 7, 1, 7), // emitter size irr::core::vector3df(0.0f, 0.06f, 0.0f), // initial direction 40, 80, // emit rate colDark, colBright, // dark en bright color 400, 1000, 0, // min and max age, angle { 0.5f, 0.5f }, { 1.f, 1.f }); //min and max size //Affector irr::scene::IParticleAffector* particleAffector = particleSystem->createFadeOutParticleAffector(); particleSystem->setScale({ 0.1f, 0.1f, 0.1f }); particleSystem->setMaterialFlag(irr::video::EMF_LIGHTING, false); particleSystem->setMaterialFlag(irr::video::EMF_ZWRITE_ENABLE, false); particleSystem->setMaterialType(irr::video::EMT_TRANSPARENT_ADD_COLOR); particleSystem->setParent(m_FlagNode); particleSystem->setPosition({ 1.0f, 0, 0 }); //Drop systems after setting them particleSystem->setEmitter(particleEmitter); particleEmitter->drop(); particleSystem->addAffector(particleAffector); particleAffector->drop(); }
Color::Color( const Colorf& source ) { setRed( convertColorFloatToByte(source.red()) ); setGreen( convertColorFloatToByte(source.green()) ); setBlue( convertColorFloatToByte(source.blue()) ); setAlpha( convertColorFloatToByte(source.alpha()) ); }
int32_t LuaDrawable::setAlpha(lua_State *L) { auto drawable = Lua::getObject<Drawable>(L, 1, LuaType::Drawable); auto alpha = static_cast<float>(Lua::getNumber(L, 2)); drawable->setAlpha(alpha); return 0; }