PassOwnPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::createPropertySpecificKeyframe(PropertyHandle property) const { if (property.isCSSProperty()) return adoptPtr(new CSSPropertySpecificKeyframe(offset(), &easing(), cssPropertyValue(property.cssProperty()), composite())); ASSERT(property.isSVGAttribute()); return adoptPtr(new SVGPropertySpecificKeyframe(offset(), &easing(), svgPropertyValue(property.svgAttribute()), composite())); }
void RoundPageScrollView::update(float dt) { int calId = calCurrId(); if(currId != calId) { callBack(calId); currId = calId; } if(!isTouchMoving) { if(defaultAction) { easing(desW); } else { if(!isOpen) { radius = radius>80 ? radius-5 : 80; nodeScaleControll = nodeScaleControll>0.21? nodeScaleControll-0.04 : 0.2; } else { radius = radius<Radius ? radius+5 : Radius; nodeScaleControll = nodeScaleControll<1? nodeScaleControll+0.05 : 1; if(radius == Radius && nodeScaleControll == 1) { setTouchEnabled(true); defaultAction = true; v0 = 0; calDesW(); } } //CCLog(PH::toStr(nodeScaleControll).c_str()); w += 0.25*(dt*60); } } updatePos(); render(); }
PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::createPropertySpecificKeyframe(CSSPropertyID property) const { return adoptPtrWillBeNoop(new PropertySpecificKeyframe(offset(), easing(), propertyValue(property), composite())); }
PassOwnPtr<Keyframe::PropertySpecificKeyframe> AnimatableValueKeyframe::createPropertySpecificKeyframe(CSSPropertyID property) const { return adoptPtr(new PropertySpecificKeyframe(offset(), &easing(), propertyValue(property), composite())); }
PassRefPtr<Keyframe::PropertySpecificKeyframe> AnimatableValueKeyframe::createPropertySpecificKeyframe(PropertyHandle property) const { return PropertySpecificKeyframe::create(offset(), &easing(), propertyValue(property.cssProperty()), composite()); }
void VEScrollView::update(float dt) { if(!m_bTouchEnabled) return; if(!m_bTouching ) { CCPoint pos = m_pContainer->getPosition(); CCSize gap = m_contentSize - m_viewSize; gap.width = MAX(gap.width, 0); gap.height = MAX(gap.height, 0); switch (m_eType) { case SCROLLVIEW_HORIZONTAL: if (pos.x > 0) { easing(0); m_fTouchOffset = 0; } if (pos.x < -gap.width) { easing(-gap.width); m_fTouchOffset = 0; } if (m_fTouchOffset != 0) { m_fTouchOffset-=1; if(m_fTouchOffset < 0) m_fTouchOffset = 0; m_pContainer->setPositionX(m_pContainer->getPositionX() + m_moveDir * m_fTouchOffset); } break; case SCROLLVIEW_VERTICAL: if (pos.y < 0) { easing(0); m_fTouchOffset = 0; } if (pos.y > gap.height) { easing(gap.height); m_fTouchOffset = 0; } if (m_fTouchOffset != 0) { m_fTouchOffset-=1; if(m_fTouchOffset < 0 ) m_fTouchOffset = 0; m_pContainer->setPositionY(m_pContainer->getPositionY() + m_moveDir * m_fTouchOffset); } break; default: CCLOG("wrong scroll type"); this->unscheduleUpdate(); break; } } if(m_scrollBar && m_scrollBar->getOpacity()) { CCPoint pos = m_pContainer->getPosition(); CCSize gap = m_contentSize - m_viewSize; gap.width = MAX(gap.width, 0); gap.height = MAX(gap.height, 0); pos.x = MIN(pos.x, 0); pos.x = MAX(pos.x, -gap.width); pos.y = MAX(pos.y, 0); pos.y = MIN(pos.y, gap.height); static bool bFirstHalf = true; float offset = 0.f; switch(m_eType) { case SCROLLVIEW_HORIZONTAL: if (pos.x < -gap.width/2 && bFirstHalf) { bFirstHalf = false; m_scrollBar->setAnchorPoint(ccp(1, 0.5f)); //offset = m_barSize.height; } else if(pos.x > -gap.width/2 && !bFirstHalf) { bFirstHalf = true; m_scrollBar->setAnchorPoint(ccp(0, 0.5f)); //offset = -m_barSize.height; } if (bFirstHalf) m_scrollBar->setPositionX(-m_viewSize.width/2-pos.x*m_barScale - offset); else m_scrollBar->setPositionX(-m_viewSize.width/2-pos.x*m_barScale+m_barSize.width - offset); break; case SCROLLVIEW_VERTICAL: if (pos.y > gap.height/2 && bFirstHalf) { bFirstHalf = false; m_scrollBar->setAnchorPoint(ccp(0.5, 0.f)); //offset = m_barSize.height; } else if(pos.y < gap.height/2 && !bFirstHalf) { bFirstHalf = true; m_scrollBar->setAnchorPoint(ccp(0.5, 1.f)); //offset = -m_barSize.height; } if (bFirstHalf) m_scrollBar->setPositionY(m_viewSize.height/2-pos.y*m_barScale - offset); else m_scrollBar->setPositionY(m_viewSize.height/2-pos.y*m_barScale-m_barSize.height - offset); break; default: CCLOG("wrong scroll type"); break; } // auto-scale scrollbar pos = m_pContainer->getPosition(); float scale = 1.f; switch(m_eType) { case SCROLLVIEW_HORIZONTAL: if (pos.x > 0.f) { scale = 1.f - pos.x/m_viewSize.width; } else if(pos.x < -(m_contentSize.width-m_viewSize.width)) { scale = 1.f - fabsf(pos.x+m_contentSize.width-m_viewSize.width)/m_viewSize.width; } m_scrollBar->setScaleX(scale); break; case SCROLLVIEW_VERTICAL: if (pos.y < 0.f) { scale = 1.f - fabsf(pos.y)/m_viewSize.height; } else if(pos.y > m_contentSize.height-m_viewSize.height ) { scale = 1.f - (pos.y-m_contentSize.height+m_viewSize.height)/m_viewSize.height; } m_scrollBar->setScaleY(scale); break; default: CCLOG("wrong scroll type"); break; } } //reArrange(); }