<commit_before>package com.github.matteobattilana.weather.confetti

import android.graphics.*
import com.github.jinatonic.confetti.ConfettoGenerator
import com.github.jinatonic.confetti.confetto.Confetto
import com.github.matteobattilana.weather.PrecipType
import java.util.*

/**
 * Created by Mitchell on 7/4/2017.
 */
class WeatherConfettoGenerator(val confettoInfo: ConfettoInfo) : ConfettoGenerator {
    override fun generateConfetto(random: Random): Confetto = MotionBlurBitmapConfetto(confettoInfo)
}

class MotionBlurBitmapConfetto(val confettoInfo: ConfettoInfo) : Confetto() {
    companion object {
        const val SNOW_RADIUS = 7.5f
        const val RAIN_STRETCH = 20f
    }

    override fun getHeight(): Int = 0

    override fun getWidth(): Int = 0

    override fun configurePaint(paint: Paint) {
        super.configurePaint(paint)
        paint.color = Color.WHITE
        paint.isAntiAlias = true
    }

    override fun drawInternal(canvas: Canvas, matrix: Matrix, paint: Paint, x: Float, y: Float, rotation: Float, percentageAnimated: Float) {

        when (confettoInfo.precipType) {
                PrecipType.CLEAR -> {
                }
                PrecipType.RAIN -> {
                    var rainStretch = RAIN_STRETCH * confettoInfo.scaleFactor / 2f;
                    val dX = currentVelocityX
                    val dY = currentVelocityY
                    val x1 = x - dX * rainStretch
                    val y1 = y - dY * rainStretch
                    val x2 = x + dX * rainStretch
                    val y2 = y + dY * rainStretch<commit_msg>Fix missing starting value for rain scale factor<commit_after>package com.github.matteobattilana.weather.confetti

import android.graphics.*
import com.github.jinatonic.confetti.ConfettoGenerator
import com.github.jinatonic.confetti.confetto.Confetto
import com.github.matteobattilana.weather.PrecipType
import java.util.*

/**
 * Created by Mitchell on 7/4/2017.
 */
class WeatherConfettoGenerator(val confettoInfo: ConfettoInfo) : ConfettoGenerator {
    override fun generateConfetto(random: Random): Confetto = MotionBlurBitmapConfetto(confettoInfo)
}

class MotionBlurBitmapConfetto(val confettoInfo: ConfettoInfo) : Confetto() {
    companion object {
        const val SNOW_RADIUS = 7.5f
        const val RAIN_STRETCH = 20f
    }

    override fun getHeight(): Int = 0

    override fun getWidth(): Int = 0

    override fun configurePaint(paint: Paint) {
        super.configurePaint(paint)
        paint.color = Color.WHITE
        paint.isAntiAlias = true
    }

    override fun drawInternal(canvas: Canvas, matrix: Matrix, paint: Paint, x: Float, y: Float, rotation: Float, percentageAnimated: Float) {

        when (confettoInfo.precipType) {
                PrecipType.CLEAR -> {
                }
                PrecipType.RAIN -> {
                    var rainStretch = RAIN_STRETCH * (confettoInfo.scaleFactor + 1.0f) / 2f;
                    val dX = currentVelocityX
                    val dY = currentVelocityY
                    val x1 = x - dX * rainStretch
                    val y1 = y - dY * rainStretch
                    val x2 = x + dX * rainStretch
                    val y2 = y + dY * rainStretch
{'fraction_non_alphanumeric': 0.08121512709237445, 'fraction_numerical': 0.011159330440173589, 'mean_word_length': 2.371995820271682, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6652524', 'n_tokens_mistral': 1012, 'n_tokens_neox': 930, 'n_words': 233}