• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ParticleSystem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.plattysoft.leonids.ParticleSystem的典型用法代码示例。如果您正苦于以下问题:Java ParticleSystem类的具体用法?Java ParticleSystem怎么用?Java ParticleSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParticleSystem类属于com.plattysoft.leonids包,在下文中一共展示了ParticleSystem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onTouchEvent

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
	switch (event.getAction()) {
	case MotionEvent.ACTION_DOWN:
		// Create a particle system and start emiting
		ps = new ParticleSystem(this, 100, R.drawable.star_pink, 800);
		ps.setScaleRange(0.7f, 1.3f);
		ps.setSpeedRange(0.05f, 0.1f);
		ps.setRotationSpeedRange(90, 180);
		ps.setFadeOut(200, new AccelerateInterpolator());
		ps.emit((int) event.getX(), (int) event.getY(), 40);
		break;
	case MotionEvent.ACTION_MOVE:
		ps.updateEmitPoint((int) event.getX(), (int) event.getY());
		break;
	case MotionEvent.ACTION_UP:
		ps.stopEmitting();
		break;
	}
	return true;
}
 
开发者ID:plattysoft,项目名称:Leonids,代码行数:22,代码来源:FollowCursorExampleActivity.java


示例2: showMoneyEarned

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
@Override
public void showMoneyEarned(int earned) {
    final ViewGroup parent = (ViewGroup) getView();
    final View emitAtView = mRiddleView;
    final int emitGravity = Gravity.CENTER;
    if (parent == null || emitAtView == null || earned <= 0) {
        return;
    }
    new ParticleSystem(getResources(), earned, R.drawable.think_currency,
            3000L, parent)
            .setScaleRange(0.8f, 1.2f)
            .setSpeedModuleAndAngleRange(0.0005f, 0.001f, 0, 360)
            .setAccelerationModuleAndAndAngleRange(0.00009f, 0.0001f, 275, 310)
            .setFadeOut(200, new AccelerateInterpolator())
            .emitWithGravity(emitAtView, emitGravity, earned, 1000);
}
 
开发者ID:DanDits,项目名称:WhatsThat,代码行数:17,代码来源:RiddleFragment.java


示例3: onClick

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
@Override
public void onClick(View arg0) {
	ParticleSystem ps = new ParticleSystem(this, 100, R.drawable.star_pink, 800);
	ps.setScaleRange(0.7f, 1.3f);
	ps.setSpeedRange(0.1f, 0.25f);
	ps.setRotationSpeedRange(90, 180);
	ps.setFadeOut(200, new AccelerateInterpolator());
	ps.oneShot(arg0, 70);

	ParticleSystem ps2 = new ParticleSystem(this, 100, R.drawable.star_white, 800);
	ps2.setScaleRange(0.7f, 1.3f);
	ps2.setSpeedRange(0.1f, 0.25f);
	ps.setRotationSpeedRange(90, 180);
	ps2.setFadeOut(200, new AccelerateInterpolator());
	ps2.oneShot(arg0, 70);
}
 
开发者ID:plattysoft,项目名称:Leonids,代码行数:17,代码来源:FireworksExampleActivity.java


示例4: onCreate

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button button = (Button) findViewById(R.id.emitter_button);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            new ParticleSystem(MainActivity.this, 80, R.drawable.confeti_purple, 10000)
                    .setSpeedModuleAndAngleRange(0.1f, 0.3f, 180, 270)
                    .setRotationSpeed(144)
                    .setAcceleration(0.00017f, 90)
                    .emitWithGravity(findViewById(R.id.emitter_top_right), 1, 8);

            new ParticleSystem(MainActivity.this, 80, R.drawable.confeti_red, 10000)
                    .setSpeedModuleAndAngleRange(0.1f, 0.3f, 240, 300)
                    .setRotationSpeed(144)
                    .setAcceleration(0.00017f, 90)
                    .emitWithGravity(findViewById(R.id.emitter_top_center), 1, 8);

            new ParticleSystem(MainActivity.this, 80, R.drawable.confeti_white, 10000)
                    .setSpeedModuleAndAngleRange(0.1f, 0.3f, 270, 0)
                    .setRotationSpeed(144)
                    .setAcceleration(0.00017f, 90)
                    .emitWithGravity(findViewById(R.id.emitter_top_left), 1, 8);
        }
    });
}
 
开发者ID:NikoYuwono,项目名称:ConfettiDemo,代码行数:29,代码来源:MainActivity.java


示例5: startAnimation

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
/**
 * Added a Runnable in order to avoid error during the animation. This method
 * wait until the view is loaded and then it plays the animation
 */
public void startAnimation() {
    stopAnimation();
    switch (getCurrentWeather()) {
        case RAIN:
            mParticleSystem = new ParticleSystem((ViewGroup) this.getParent(), mRainParticles * mRainTime / 1000, ContextCompat.getDrawable(mActivity, R.drawable.rain), mRainTime)
                    //.setAcceleration(0.00013f, 90 - mRainAngle)
                    //.setInitialRotation(-mRainAngle)
                    //.setSpeedByComponentsRange(0f, 0f, 0.05f, 0.1f)
                    .setFadeOut(mRainFadeOutTime, new AccelerateInterpolator());
                    updateAngle(90-mRainAngle);
            break;
        case SNOW:
            mParticleSystem = new ParticleSystem((ViewGroup) this.getParent(), mSnowParticles * mSnowTime / 1000, ContextCompat.getDrawable(mActivity, R.drawable.snow), mSnowTime)
                    //.setAcceleration(0.000001f, 90 - mSnowAngle)
                    //.setInitialRotation(-mSnowAngle)
                    //.setSpeedByComponentsRange(0f, 0f, 0.05f, 0.1f)
                    .setFadeOut(mSnowFadeOutTime, new AccelerateInterpolator());
                    updateAngle(90-mSnowAngle);
            break;
        default:
            break;
    }


    if (mParticleSystem != null) {

        ParticleSystem.setFPS(getFPS());

        this.post(new Runnable() {
            @Override
            public void run() {
                int width = getWidth(); // will be non-zero
                int height = getHeight(); // will be non-zero
                if (width != 0 && height != 0 && !isPlaying)
                    emitParticles();
            }
        });
    }
}
 
开发者ID:MatteoBattilana,项目名称:WeatherView,代码行数:44,代码来源:WeatherView.java


示例6: WriteBlankAnim

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
public void WriteBlankAnim(View animBlank){
    YoYo.with(Techniques.RubberBand)
            .duration(500)
            .playOn(findViewById(animBlank.getId()));

    sfxManager.KeyboardClickPlay(true);

    new ParticleSystem(this, 5, R.drawable.star_white, 800)
            .setScaleRange(0.7f, 1.3f)
            .setSpeedRange(0.1f, 0.25f)
            .setRotationSpeedRange(90, 180)
            .setFadeOut(200, new AccelerateInterpolator())
            .oneShot(animBlank, 100);
}
 
开发者ID:hypeapps,项目名称:FixMath,代码行数:15,代码来源:PlayActivity.java


示例7: WriteBlankAnimation

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
public void WriteBlankAnimation(View animBlank) {
    YoYo.with(Techniques.RubberBand)
            .duration(500)
            .playOn(findViewById(animBlank.getId()));


    sfxManager.KeyboardClickPlay(true);

    new ParticleSystem(this, 5, R.drawable.star_white, 800)
            .setScaleRange(0.7f, 1.3f)
            .setSpeedRange(0.1f, 0.25f)
            .setRotationSpeedRange(90, 180)
            .setFadeOut(200, new AccelerateInterpolator())
            .oneShot(animBlank, 100);
}
 
开发者ID:hypeapps,项目名称:FixMath,代码行数:16,代码来源:TimeAttackActivity.java


示例8: makeParticleSystem

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
public ParticleSystem makeParticleSystem(Resources res, int maxParticles, int drawableResId,
                                         long timeToLive) {
    ParticleField field = mRiddleView;
    if (field == null) {
        return null;
    }
    ParticleSystem system = new ParticleSystem(field, res, maxParticles, timeToLive);
    system.initParticles(res.getDrawable(drawableResId));
    system.setIgnorePositionInParent();
    return system;
}
 
开发者ID:DanDits,项目名称:WhatsThat,代码行数:12,代码来源:RiddleController.java


示例9: onCleanup

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
@Override
public void onCleanup(ParticleSystem toClean) {
    if (removeParticles(toClean.getActiveParticles())) {
        RiddleController ctr = mRiddleCtr;
        if (ctr != null) {
            ctr.onParticleSystemCountChanged();
        }
    }
}
 
开发者ID:DanDits,项目名称:WhatsThat,代码行数:10,代码来源:RiddleView.java


示例10: onMove

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
private boolean onMove(float x, float y) {
    int index = 0;
    float minR = 2.f * ImageUtil.convertDpToPixel(MIN_RADIUS, mConfig.mScreenDensity);
    float humanFingerThickness = ImageUtil.convertDpToPixel(HUMAN_FINGER_THICKNESS, mConfig.mScreenDensity);
    // since the number of circles can easily get very high we are not very strict here with picking a circle
    // the first one that can evolve and is close enough will be used
    while (index < mCircleCenterX.size() && mLock.isUnlocked(index)) {
        float currX = mCircleCenterX.get(index);
        float currY = mCircleCenterY.get(index);
        float currR = mCircleRadius.get(index);
        double dist = Math.sqrt((currX - x) * (currX - x) + (currY - y) * (currY - y));
        if (dist <= Math.max(currR, humanFingerThickness) && currR >= minR) {
            mLock.lock(1);
            float newRadius = currR / 2.f;
            // don't redraw all but only the required area
            mCirclesCanvas.drawRect(currX - currR, currY - currR, currX + currR, currY + currR, mClearPaint);
            evolveCircleUnchecked(index, currX, currY, newRadius, true);
            mConfig.mAchievementGameData.increment(AchievementCircle.KEY_CIRCLE_DIVIDED_BY_MOVE, 1L, 0L);

            ParticleSystem system = mParticlePool.obtain();
            if (system != null) {
                system.clearInitializers();
                float scale = 1.f + 3f * (currR * 2f / mConfig.mWidth); // factor from 1 to 4
                system.setSpeedModuleAndAngleRange(0.05f, 0.15f, 0, 360)
                        .setAccelerationModuleAndAndAngleRange(0.0001f, 0.0002f, 0, 360)
                        .setScaleRange(scale - 0.05f, scale + 0.05f);
                system.emit((int) currX, (int) currY, 10, 300);
            }
            return true;
        }
        index++;
    }
    return false;
}
 
开发者ID:DanDits,项目名称:WhatsThat,代码行数:35,代码来源:RiddleCircle.java


示例11: setAnimationFilter

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
public void setAnimationFilter(Activity activity) {
    if (particleSystem != null) return;
    particleSystem = new ParticleSystem(activity, 80, R.drawable.star, 1000)
            .setSpeedModuleAndAngleRange(0f, 0.3f, 0, 360)
            .setAcceleration(0.00005f, 90);

    particleSystem.emit(animationFilter, 8);
}
 
开发者ID:jphacks,项目名称:TK_1511,代码行数:9,代码来源:ExtensionBrowserCanvas.java


示例12: finish_anim

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
public void finish_anim() {
    Animation animFadein = AnimationUtils.loadAnimation(
            getApplicationContext(), R.anim.slide_finish);
    level_finished.setVisibility(View.VISIBLE);
    animFadein.setAnimationListener(finish_anim);

    level_finished.startAnimation(animFadein);

    int count = screenH / 100;

    for (int i = 0; i < count; i++) {
        int id_image = 0;
        if (i % 2 == 0)
            id_image = R.drawable.star_pink;
        else
            id_image = R.drawable.star_white;

        ParticleSystem ps = new ParticleSystem(this, 100, id_image, 800);
        ps.setScaleRange(0.7f, 1.3f);
        ps.setSpeedRange(0.2f, 0.5f);
        ps.setRotationSpeedRange(90, 180);
        ps.setFadeOut(200, new AccelerateInterpolator());
        int xStart = (int) (screenW * Math.random());
        int yStart = (int) (screenH * Math.random());
        ps.oneShot(xStart, yStart, 70);
    }


    final Animation scale = AnimationUtils.loadAnimation(
            getApplicationContext(), R.anim.scale_anim);

    homeBtn.startAnimation(scale);

    Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-51610813-3");
    tracker.send(MapBuilder
            .createEvent("Level", packName, "finish_drawing_" + level, null)
            .build());

}
 
开发者ID:AlexZaiats,项目名称:Coloring-book,代码行数:40,代码来源:DrawerActivity.java


示例13: onClick

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
@Override
public void onClick(View arg0) {
	ParticleSystem ps = new ParticleSystem(this, 100, R.drawable.star_pink, 1000);
	ps.setScaleRange(0.7f, 1.3f);
	ps.setSpeedModuleAndAngleRange(0.07f, 0.16f, 0, 180);
	ps.setRotationSpeedRange(90, 180);
	ps.setAcceleration(0.00013f, 90);
	ps.setFadeOut(200, new AccelerateInterpolator());
	ps.emit(arg0, 100, 2000);
}
 
开发者ID:plattysoft,项目名称:Leonids,代码行数:11,代码来源:EmiterTimeLimitedExampleActivity.java


示例14: onClick

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
@Override
public void onClick(View arg0) {		
	ParticleSystem ps = new ParticleSystem(this, 100, R.drawable.star_pink, 1000);
	ps.setScaleRange(0.7f, 1.3f);
	ps.setSpeedModuleAndAngleRange(0.07f, 0.16f, 0, 180);
	ps.setRotationSpeedRange(90, 180);
	ps.setAcceleration(0.00013f, 90);
	ps.setFadeOut(200, new AccelerateInterpolator());
	ps.emit(arg0, 100);
}
 
开发者ID:plattysoft,项目名称:Leonids,代码行数:11,代码来源:EmiterIntermediateExampleActivity.java


示例15: onClick

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
@Override
public void onClick(View arg0) {
	// Launch 2 particle systems one for each image
	ParticleSystem ps = new ParticleSystem(this, 100, R.drawable.star_white_border, 800);
	ps.setScaleRange(0.7f, 1.3f);
	ps.setSpeedRange(0.1f, 0.25f);
	ps.setAcceleration(0.0001f, 90);
	ps.setRotationSpeedRange(90, 180);
	ps.setFadeOut(200, new AccelerateInterpolator());
	ps.oneShot(arg0, 100);
}
 
开发者ID:plattysoft,项目名称:Leonids,代码行数:12,代码来源:OneShotAdvancedExampleActivity.java


示例16: onClick

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
@Override
public void onClick(View arg0) {		
	new ParticleSystem(this, 80, R.drawable.confeti2, 10000)
	.setSpeedModuleAndAngleRange(0f, 0.1f, 180, 180)
	.setRotationSpeed(144)
	.setAcceleration(0.000017f, 90)		
	.emit(findViewById(R.id.emiter_top_right), 8);
			
	new ParticleSystem(this, 80, R.drawable.confeti3, 10000)
	.setSpeedModuleAndAngleRange(0f, 0.1f, 0, 0)
	.setRotationSpeed(144)
	.setAcceleration(0.000017f, 90)		
	.emit(findViewById(R.id.emiter_top_left), 8);
}
 
开发者ID:plattysoft,项目名称:Leonids,代码行数:15,代码来源:ConfettiExampleActivity.java


示例17: onClick

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
@Override
public void onClick(View arg0) {
	new ParticleSystem(this, 100, R.drawable.star_pink, 3000)
	.setAcceleration(0.00013f, 90)
	.setSpeedByComponentsRange(0f, 0f, 0.05f, 0.1f)
	.setFadeOut(200, new AccelerateInterpolator())
	.emitWithGravity(arg0, Gravity.BOTTOM, 30);
}
 
开发者ID:plattysoft,项目名称:Leonids,代码行数:9,代码来源:EmiterWithGravityExampleActivity.java


示例18: onClick

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
@Override
public void onClick(View arg0) {
	new ParticleSystem(this, 10, R.drawable.star, 3000)		
	.setSpeedByComponentsRange(-0.1f, 0.1f, -0.1f, 0.02f)
	.setAcceleration(0.000003f, 90)
	.setInitialRotationRange(0, 360)
	.setRotationSpeed(120)
	.setFadeOut(2000)
	.addModifier(new ScaleModifier(0f, 1.5f, 0, 1500))
	.oneShot(arg0, 10);
}
 
开发者ID:plattysoft,项目名称:Leonids,代码行数:12,代码来源:StarsExampleActivity.java


示例19: onClick

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
@Override
public void onClick(View arg0) {
	new ParticleSystem(this, 100, R.drawable.animated_confetti, 5000)		
	.setSpeedRange(0.1f, 0.25f)
	.setRotationSpeedRange(90, 180)
	.setInitialRotationRange(0, 360)
	.oneShot(arg0, 100);
}
 
开发者ID:plattysoft,项目名称:Leonids,代码行数:9,代码来源:AnimatedParticlesExampleActivity.java


示例20: onClick

import com.plattysoft.leonids.ParticleSystem; //导入依赖的package包/类
@Override
public void onClick(View arg0) {
	new ParticleSystem(this, 4, R.drawable.dust, 3000)
	.setSpeedByComponentsRange(-0.025f, 0.025f, -0.06f, -0.08f)		
	.setAcceleration(0.00001f, 30)
	.setInitialRotationRange(0, 360)
	.addModifier(new AlphaModifier(255, 0, 1000, 3000))
	.addModifier(new ScaleModifier(0.5f, 2f, 0, 1000))
	.oneShot(findViewById(R.id.emiter_bottom), 4);
}
 
开发者ID:plattysoft,项目名称:Leonids,代码行数:11,代码来源:DustExampleActivity.java



注:本文中的com.plattysoft.leonids.ParticleSystem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DeleteResponseProto类代码示例发布时间:2022-05-22
下一篇:
Java RuntimeIOException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap