implemented opacity function